Skip to content

Commit e811380

Browse files
committed
Doc updates.
1 parent a941e75 commit e811380

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ ordered collection types that use B-trees for their underlying storage.
6060
by the higher-level abstractions above (and more!).
6161

6262
The `BTree` type is public; you may want to use it if you need a collection flavor that
63-
isn't provided by default (such as a MultiMap or a Bag),
63+
isn't provided by default (such as a multimap)
6464
or if you need to use an operation that isn't exposed by the wrappers.
6565

6666
All of these collections are structs and they implement the same copy-on-write value semantics as

Sources/SortedBag.swift

+8-5
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,22 @@
77
//
88

99
/// A sorted collection of comparable elements; also known as a multiset.
10-
/// `SortedBag` is like a `SortedSet` that allows multiple members that are equal to each other.
10+
/// `SortedBag` is like a `SortedSet` except it can contain multiple members that are equal to each other.
1111
/// Lookup, insertion and removal of any element has logarithmic complexity.
1212
///
1313
/// `SortedBag` stores duplicate elements in their entirety; it doesn't just count multiplicities.
1414
/// This is an important feature when equal elements can be distinguished by identity comparison or some other means.
15+
/// (If you're OK with just counting duplicates, use a `Map` or a `Dictionary` with the multiplicity as the value.)
1516
///
1617
/// `SortedBag` is a struct with copy-on-write value semantics, like Swift's standard collection types.
17-
/// It uses an in-memory b-tree for element storage, whose individual nodes may be shared with other ordered sets.
18-
/// Mutating a set whose storage is (partially or completely) shared requires copying of only O(log(`count`)) elements.
19-
/// (Thus, mutation of shared ordered sets may be cheaper than ordinary sets, which need to copy all elements.)
18+
/// It uses an in-memory b-tree for element storage, whose individual nodes may be shared with other sorted sets or bags.
19+
/// Mutating a bag whose storage is (partially or completely) shared requires copying of only O(log(`count`)) elements.
20+
/// (Thus, mutation of shared `SortedBag`s may be cheaper than ordinary `Set`s, which need to copy all elements.)
2021
///
21-
/// Set operations on ordered sets (such as taking the union, intersection or difference) can take as little as
22+
/// Set operations on sorted bags (such as taking the union, intersection or difference) can take as little as
2223
/// O(log(n)) time if the elements in the input bags aren't too interleaved.
24+
///
25+
/// - SeeAlso: `SortedSet`
2326
public struct SortedBag<Element: Comparable>: SetAlgebra {
2427
internal typealias Tree = BTree<Element, Void>
2528

Sources/SortedSet.swift

+5-3
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@
1111
/// Lookup, insertion and removal of any element has logarithmic complexity.
1212
///
1313
/// `SortedSet` is a struct with copy-on-write value semantics, like Swift's standard collection types.
14-
/// It uses an in-memory b-tree for element storage, whose individual nodes may be shared with other ordered sets.
14+
/// It uses an in-memory b-tree for element storage, whose individual nodes may be shared with other sorted sets.
1515
/// Mutating a set whose storage is (partially or completely) shared requires copying of only O(log(`count`)) elements.
16-
/// (Thus, mutation of shared ordered sets may be cheaper than ordinary sets, which need to copy all elements.)
16+
/// (Thus, mutation of shared `SortedSet`s may be cheaper than ordinary `Set`s, which need to copy all elements.)
1717
///
18-
/// Set operations on ordered sets (such as taking the union, intersection or difference) can take as little as
18+
/// Set operations on sorted sets (such as taking the union, intersection or difference) can take as little as
1919
/// O(log(n)) time if the elements in the input sets aren't too interleaved.
20+
///
21+
/// - SeeAlso: `SortedBag`
2022
public struct SortedSet<Element: Comparable>: SetAlgebra {
2123
internal typealias Tree = BTree<Element, Void>
2224

0 commit comments

Comments
 (0)