From ddff9004d745c4b2d13e35ebdd1a3d0b67e14717 Mon Sep 17 00:00:00 2001 From: Nate Cook Date: Fri, 24 Oct 2025 14:28:10 -0500 Subject: [PATCH] Include notes about index mutation in span(after/before:) The indexes passed to span(after:) and friends on UniqueArray and RigidArray are modified before return. This adds notes about the updated values to the method documentation, along with a few other minor formatting changes (dropping smart quotes, single-sentence abstracts). --- .../RigidArray+Insertions.swift | 12 ++--- Sources/BasicContainers/RigidArray.swift | 46 ++++++++++++++----- .../UniqueArray+Insertions.swift | 12 ++--- Sources/BasicContainers/UniqueArray.swift | 45 +++++++++++++----- .../BitArray/BitArray+Collection.swift | 2 +- .../BitSet+BidirectionalCollection.swift | 2 +- .../BitCollections/BitSet/BitSet+Extras.swift | 4 +- Sources/DequeModule/Deque+Collection.swift | 6 +-- .../TreeDictionary+Collection.swift | 2 +- .../TreeDictionary/TreeDictionary+Keys.swift | 2 +- .../TreeDictionary+Values.swift | 2 +- .../TreeSet/TreeSet+Collection.swift | 2 +- .../TreeSet/TreeSet+Extras.swift | 2 +- ...deredDictionary+Elements.SubSequence.swift | 2 +- .../OrderedDictionary+Values.swift | 2 +- .../OrderedSet+RandomAccessCollection.swift | 2 +- .../OrderedSet/OrderedSet+SubSequence.swift | 4 +- .../SortedDictionary+Initializers.swift | 4 +- ...y+Partial RangeReplaceableCollection.swift | 2 +- .../SortedDictionary+Subscripts.swift | 6 +-- .../SortedDictionary/SortedDictionary.swift | 2 +- ...t+Partial RangeReplaceableCollection.swift | 2 +- 22 files changed, 104 insertions(+), 61 deletions(-) diff --git a/Sources/BasicContainers/RigidArray+Insertions.swift b/Sources/BasicContainers/RigidArray+Insertions.swift index 669a4fc10..283f57dbc 100644 --- a/Sources/BasicContainers/RigidArray+Insertions.swift +++ b/Sources/BasicContainers/RigidArray+Insertions.swift @@ -256,7 +256,7 @@ extension RigidArray { /// array at the specified position. /// /// The new elements are inserted before the element currently at the - /// specified index. If you pass the array’s `endIndex` as the `index` + /// specified index. If you pass the array's `endIndex` as the `index` /// parameter, then the new elements are appended to the end of the array. /// /// All existing elements at or following the specified position are moved to @@ -289,7 +289,7 @@ extension RigidArray { /// array at the specified position. /// /// The new elements are inserted before the element currently at the - /// specified index. If you pass the array’s `endIndex` as the `index` + /// specified index. If you pass the array's `endIndex` as the `index` /// parameter, then the new elements are appended to the end of the array. /// /// All existing elements at or following the specified position are moved to @@ -316,7 +316,7 @@ extension RigidArray { /// Copies the elements of a span into this array at the specified position. /// /// The new elements are inserted before the element currently at the - /// specified index. If you pass the array’s `endIndex` as the `index` + /// specified index. If you pass the array's `endIndex` as the `index` /// parameter, then the new elements are appended to the end of the array. /// /// All existing elements at or following the specified position are moved to @@ -392,7 +392,7 @@ extension RigidArray { /// position. /// /// The new elements are inserted before the element currently at the - /// specified index. If you pass the array’s `endIndex` as the `index` + /// specified index. If you pass the array's `endIndex` as the `index` /// parameter, then the new elements are appended to the end of the array. /// /// All existing elements at or following the specified position are moved to @@ -423,7 +423,7 @@ extension RigidArray { /// position. /// /// The new elements are inserted before the element currently at the - /// specified index. If you pass the array’s `endIndex` as the `index` + /// specified index. If you pass the array's `endIndex` as the `index` /// parameter, then the new elements are appended to the end of the array. /// /// All existing elements at or following the specified position are moved @@ -452,7 +452,7 @@ extension RigidArray { /// position. /// /// The new elements are inserted before the element currently at the - /// specified index. If you pass the array’s `endIndex` as the `index` + /// specified index. If you pass the array's `endIndex` as the `index` /// parameter, then the new elements are appended to the end of the array. /// /// All existing elements at or following the specified position are moved to diff --git a/Sources/BasicContainers/RigidArray.swift b/Sources/BasicContainers/RigidArray.swift index 6d78ed8c5..5058dc6db 100644 --- a/Sources/BasicContainers/RigidArray.swift +++ b/Sources/BasicContainers/RigidArray.swift @@ -139,6 +139,7 @@ extension RigidArray where Element: ~Copyable { } /// A Boolean value indicating whether this rigid array is fully populated. + /// /// If this property returns true, then the array's storage is at capacity, /// and it cannot accommodate any additional elements. /// @@ -210,6 +211,7 @@ extension RigidArray where Element: ~Copyable { extension RigidArray where Element: ~Copyable { /// Arbitrarily edit the storage underlying this array by invoking a /// user-supplied closure with a mutable `OutputSpan` view over it. + /// /// This method calls its function argument precisely once, allowing it to /// arbitrarily modify the contents of the output span it is given. /// The argument is free to add, remove or reorder any items; however, @@ -303,18 +305,22 @@ extension RigidArray where Element: ~Copyable { /// start. /// /// Valid indices consist of the position of every element and a "past the - /// end” position that’s not valid for use as a subscript argument. + /// end" position that's not valid for use as a subscript argument. public typealias Index = Int - /// The position of the first element in a nonempty array. This is always zero. + /// The position of the first element in a nonempty array. + /// + /// `startIndex` is always zero. /// /// - Complexity: O(1) @inlinable @inline(__always) public var startIndex: Int { 0 } - /// The array’s "past the end” position—that is, the position one greater than - /// the last valid subscript argument. This is always equal to array's count. + /// The array's "past the end" position—that is, the position one greater than + /// the last valid subscript argument. + /// + /// `endIndex` is always equal to the array's count. /// /// - Complexity: O(1) @inlinable @@ -389,10 +395,14 @@ extension RigidArray where Element: ~Copyable { @available(SwiftStdlib 5.0, *) extension RigidArray where Element: ~Copyable { /// Return a borrowing span over the maximal storage chunk following the - /// specified position in the array. The span provides direct read-only access - /// to all array elements in the range `index ..< count`. + /// specified position in the array. + /// + /// The returned span provides direct read-only access to all array elements + /// in the range `index ..< count`. /// /// - Parameter index: A valid index in the array, including the end index. + /// When `span(after:)` returns, `index` is equal to the array's + /// `endIndex`. /// /// - Complexity: O(1) @inlinable @@ -402,10 +412,14 @@ extension RigidArray where Element: ~Copyable { } /// Return a borrowing span over the maximal storage chunk preceding the - /// specified position in the array. The span provides direct read-only access - /// to all array elements in the range `0 ..< index`. + /// specified position in the array. + /// + /// The returned span provides direct read-only access to all array elements + /// in the range `0 ..< index`. /// /// - Parameter index: A valid index in the array, including the end index. + /// When `span(before:)` returns, `index` is equal to the array's + /// `startIndex`. /// /// - Complexity: O(1) @inlinable @@ -418,10 +432,14 @@ extension RigidArray where Element: ~Copyable { @available(SwiftStdlib 5.0, *) extension RigidArray where Element: ~Copyable { /// Return a mutable span over the maximal storage chunk following the - /// specified position in the array. The span provides direct mutating access - /// to all array elements in the range `index ..< count`. + /// specified position in the array. + /// + /// The returned span provides direct mutating access to all array elements + /// in the range `index ..< count`. /// /// - Parameter index: A valid index in the array, including the end index. + /// When `mutableSpan(after:)` returns, `index` is equal to the array's + /// `endIndex`. /// /// - Complexity: O(1) @_lifetime(&self) @@ -432,10 +450,14 @@ extension RigidArray where Element: ~Copyable { } /// Return a mutable span over the maximal storage chunk preceding the specified - /// position in the array. The span provides direct mutating access to all - /// array elements in the range `0 ..< index`. + /// position in the array. + /// + /// The returned span provides direct mutating access to all array elements + /// in the range `0 ..< index`. /// /// - Parameter index: A valid index in the array, including the end index. + /// When `mutableSpan(before:)` returns, `index` is equal to the array's + /// `startIndex`. /// /// - Complexity: O(1) @_lifetime(&self) diff --git a/Sources/BasicContainers/UniqueArray+Insertions.swift b/Sources/BasicContainers/UniqueArray+Insertions.swift index 4e9fbf27f..a62479a54 100644 --- a/Sources/BasicContainers/UniqueArray+Insertions.swift +++ b/Sources/BasicContainers/UniqueArray+Insertions.swift @@ -217,7 +217,7 @@ extension UniqueArray { /// array at the specified position. /// /// The new elements are inserted before the element currently at the - /// specified index. If you pass the array’s `endIndex` as the `index` + /// specified index. If you pass the array's `endIndex` as the `index` /// parameter, then the new elements are appended to the end of the array. /// /// All existing elements at or following the specified position are moved to @@ -247,7 +247,7 @@ extension UniqueArray { /// array at the specified position. /// /// The new elements are inserted before the element currently at the - /// specified index. If you pass the array’s `endIndex` as the `index` + /// specified index. If you pass the array's `endIndex` as the `index` /// parameter, then the new elements are appended to the end of the array. /// /// All existing elements at or following the specified position are moved to @@ -275,7 +275,7 @@ extension UniqueArray { /// Copies the elements of a span into this array at the specified position. /// /// The new elements are inserted before the element currently at the - /// specified index. If you pass the array’s `endIndex` as the `index` + /// specified index. If you pass the array's `endIndex` as the `index` /// parameter, then the new elements are appended to the end of the array. /// /// All existing elements at or following the specified position are moved to @@ -305,7 +305,7 @@ extension UniqueArray { /// position. /// /// The new elements are inserted before the element currently at the - /// specified index. If you pass the array’s `endIndex` as the `index` + /// specified index. If you pass the array's `endIndex` as the `index` /// parameter, then the new elements are appended to the end of the array. /// /// All existing elements at or following the specified position are moved to @@ -340,7 +340,7 @@ extension UniqueArray { /// position. /// /// The new elements are inserted before the element currently at the - /// specified index. If you pass the array’s `endIndex` as the `index` + /// specified index. If you pass the array's `endIndex` as the `index` /// parameter, then the new elements are appended to the end of the array. /// /// All existing elements at or following the specified position are moved @@ -372,7 +372,7 @@ extension UniqueArray { /// position. /// /// The new elements are inserted before the element currently at the - /// specified index. If you pass the array’s `endIndex` as the `index` + /// specified index. If you pass the array's `endIndex` as the `index` /// parameter, then the new elements are appended to the end of the array. /// /// All existing elements at or following the specified position are moved to diff --git a/Sources/BasicContainers/UniqueArray.swift b/Sources/BasicContainers/UniqueArray.swift index 8bf93ab11..4d517f406 100644 --- a/Sources/BasicContainers/UniqueArray.swift +++ b/Sources/BasicContainers/UniqueArray.swift @@ -133,6 +133,7 @@ extension UniqueArray where Element: ~Copyable { extension UniqueArray where Element: ~Copyable { /// Arbitrarily edit the storage underlying this array by invoking a /// user-supplied closure with a mutable `OutputSpan` view over it. + /// /// This method calls its function argument precisely once, allowing it to /// arbitrarily modify the contents of the output span it is given. /// The argument is free to add, remove or reorder any items; however, @@ -194,18 +195,22 @@ extension UniqueArray where Element: ~Copyable { /// start. /// /// Valid indices consist of the position of every element and a "past the - /// end” position that’s not valid for use as a subscript argument. + /// end" position that's not valid for use as a subscript argument. public typealias Index = Int - /// The position of the first element in a nonempty array. This is always zero. + /// The position of the first element in a nonempty array. + /// + /// `startIndex` is always zero. /// /// - Complexity: O(1) @inlinable @inline(__always) public var startIndex: Int { _storage.startIndex } - /// The array’s "past the end” position—that is, the position one greater than - /// the last valid subscript argument. This is always equal to array's count. + /// The array's "past the end" position—that is, the position one greater than + /// the last valid subscript argument. + /// + /// `endIndex` is always equal to the array's count. /// /// - Complexity: O(1) @inlinable @@ -259,10 +264,14 @@ extension UniqueArray where Element: ~Copyable { @available(SwiftStdlib 5.0, *) extension UniqueArray where Element: ~Copyable { /// Return a borrowing span over the maximal storage chunk following the - /// specified position in the array. The span provides direct read-only access - /// to all array elements in the range `index ..< count`. + /// specified position in the array. + /// + /// The returned span provides direct read-only access to all array elements + /// in the range `index ..< count`. /// /// - Parameter index: A valid index in the array, including the end index. + /// When `span(after:)` returns, `index` is equal to the array's + /// `endIndex`. /// /// - Complexity: O(1) @inlinable @@ -272,10 +281,14 @@ extension UniqueArray where Element: ~Copyable { } /// Return a borrowing span over the maximal storage chunk preceding the - /// specified position in the array. The span provides direct read-only access - /// to all array elements in the range `0 ..< index`. + /// specified position in the array. + /// + /// The returned span provides direct read-only access to all array elements + /// in the range `0 ..< index`. /// /// - Parameter index: A valid index in the array, including the end index. + /// When `span(before:)` returns, `index` is equal to the array's + /// `startIndex`. /// /// - Complexity: O(1) @inlinable @@ -288,10 +301,14 @@ extension UniqueArray where Element: ~Copyable { @available(SwiftStdlib 5.0, *) extension UniqueArray where Element: ~Copyable { /// Return a mutable span over the maximal storage chunk following the - /// specified position in the array. The span provides direct mutating access - /// to all array elements in the range `index ..< count`. + /// specified position in the array. + /// + /// The returned span provides direct mutating access to all array elements + /// in the range `index ..< count`. /// /// - Parameter index: A valid index in the array, including the end index. + /// When `mutableSpan(after:)` returns, `index` is equal to the array's + /// `endIndex`. /// /// - Complexity: O(1) @_lifetime(&self) @@ -302,10 +319,14 @@ extension UniqueArray where Element: ~Copyable { } /// Return a mutable span over the maximal storage chunk preceding the specified - /// position in the array. The span provides direct mutating access to all - /// array elements in the range `0 ..< index`. + /// position in the array. + /// + /// The returned span provides direct mutating access to all array elements + /// in the range `0 ..< index`. /// /// - Parameter index: A valid index in the array, including the end index. + /// When `mutableSpan(before:)` returns, `index` is equal to the array's + /// `startIndex`. /// /// - Complexity: O(1) @_lifetime(&self) diff --git a/Sources/BitCollections/BitArray/BitArray+Collection.swift b/Sources/BitCollections/BitArray/BitArray+Collection.swift index 93e63cdd2..83de98316 100644 --- a/Sources/BitCollections/BitArray/BitArray+Collection.swift +++ b/Sources/BitCollections/BitArray/BitArray+Collection.swift @@ -45,7 +45,7 @@ extension BitArray: RandomAccessCollection, MutableCollection { @inlinable @inline(__always) public var startIndex: Int { 0 } - /// The collection’s “past the end” position--that is, the position one step + /// The collection's "past the end" position--that is, the position one step /// after the last valid subscript argument. /// /// - Complexity: O(1) diff --git a/Sources/BitCollections/BitSet/BitSet+BidirectionalCollection.swift b/Sources/BitCollections/BitSet/BitSet+BidirectionalCollection.swift index a5bc93360..bdc4413b2 100644 --- a/Sources/BitCollections/BitSet/BitSet+BidirectionalCollection.swift +++ b/Sources/BitCollections/BitSet/BitSet+BidirectionalCollection.swift @@ -120,7 +120,7 @@ extension BitSet: Collection, BidirectionalCollection { Index(_position: _read { $0.startIndex }) } - /// The collection’s “past the end” position--that is, the position one step + /// The collection's "past the end" position--that is, the position one step /// after the last valid subscript argument. /// /// - Complexity: O(1) diff --git a/Sources/BitCollections/BitSet/BitSet+Extras.swift b/Sources/BitCollections/BitSet/BitSet+Extras.swift index 15b8a391d..40b5d3cc2 100644 --- a/Sources/BitCollections/BitSet/BitSet+Extras.swift +++ b/Sources/BitCollections/BitSet/BitSet+Extras.swift @@ -80,7 +80,7 @@ extension BitSet { } } - /// Accesses the contiguous subrange of the collection’s elements that are + /// Accesses the contiguous subrange of the collection's elements that are /// contained within a specific integer range. /// /// let bits: BitSet = [2, 5, 6, 8, 9] @@ -122,7 +122,7 @@ extension BitSet { return Slice(base: self, bounds: bounds) } - /// Accesses the contiguous subrange of the collection’s elements that are + /// Accesses the contiguous subrange of the collection's elements that are /// contained within a specific integer range expression. /// /// let bits: BitSet = [2, 5, 6, 8, 9] diff --git a/Sources/DequeModule/Deque+Collection.swift b/Sources/DequeModule/Deque+Collection.swift index 8f4fa8b6c..110b47cb5 100644 --- a/Sources/DequeModule/Deque+Collection.swift +++ b/Sources/DequeModule/Deque+Collection.swift @@ -188,7 +188,7 @@ extension Deque: RandomAccessCollection { @inline(__always) public var startIndex: Int { 0 } - /// The deque’s “past the end” position—that is, the position one greater than + /// The deque's "past the end" position—that is, the position one greater than /// the last valid subscript argument. /// /// For an instance of `Deque`, `endIndex` is always equal to its `count`. If @@ -349,7 +349,7 @@ extension Deque: RandomAccessCollection { /// than or equal to `startIndex` and less than `endIndex`. /// /// - Complexity: Reading an element from a deque is O(1). Writing is O(1) - /// unless the deque’s storage is shared with another deque, in which case + /// unless the deque's storage is shared with another deque, in which case /// writing is O(`count`). @inlinable public subscript(index: Int) -> Element { @@ -743,7 +743,7 @@ extension Deque: RangeReplaceableCollection { /// Inserts a new element at the specified position. /// /// The new element is inserted before the element currently at the specified - /// index. If you pass the deque’s `endIndex` as the `index` parameter, the + /// index. If you pass the deque's `endIndex` as the `index` parameter, the /// new element is appended to the deque. /// /// - Parameters: diff --git a/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Collection.swift b/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Collection.swift index a3012eb3a..c143fd937 100644 --- a/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Collection.swift +++ b/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Collection.swift @@ -128,7 +128,7 @@ extension TreeDictionary: Collection { return Index(_root: _root.unmanaged, version: _version, path: path) } - /// The collection’s “past the end” position—that is, the position one greater + /// The collection's "past the end" position—that is, the position one greater /// than the last valid subscript argument. /// /// - Complexity: O(1) diff --git a/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Keys.swift b/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Keys.swift index f05eb1fe9..348639ba0 100644 --- a/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Keys.swift +++ b/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Keys.swift @@ -14,7 +14,7 @@ import InternalCollectionsUtilities #endif extension TreeDictionary { - /// A view of a persistent dictionary’s keys, as a standalone collection. + /// A view of a persistent dictionary's keys, as a standalone collection. @frozen public struct Keys { @usableFromInline diff --git a/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Values.swift b/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Values.swift index 429ee7357..2d5f73581 100644 --- a/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Values.swift +++ b/Sources/HashTreeCollections/TreeDictionary/TreeDictionary+Values.swift @@ -14,7 +14,7 @@ import InternalCollectionsUtilities #endif extension TreeDictionary { - /// A view of a dictionary’s values. + /// A view of a dictionary's values. @frozen public struct Values { @usableFromInline diff --git a/Sources/HashTreeCollections/TreeSet/TreeSet+Collection.swift b/Sources/HashTreeCollections/TreeSet/TreeSet+Collection.swift index b0a8f72df..ae5280257 100644 --- a/Sources/HashTreeCollections/TreeSet/TreeSet+Collection.swift +++ b/Sources/HashTreeCollections/TreeSet/TreeSet+Collection.swift @@ -128,7 +128,7 @@ extension TreeSet: Collection { return Index(_root: _root.unmanaged, version: _version, path: path) } - /// The collection’s “past the end” position—that is, the position one greater + /// The collection's "past the end" position—that is, the position one greater /// than the last valid subscript argument. /// /// - Complexity: O(1) diff --git a/Sources/HashTreeCollections/TreeSet/TreeSet+Extras.swift b/Sources/HashTreeCollections/TreeSet/TreeSet+Extras.swift index f02ac45f6..39f413a0a 100644 --- a/Sources/HashTreeCollections/TreeSet/TreeSet+Extras.swift +++ b/Sources/HashTreeCollections/TreeSet/TreeSet+Extras.swift @@ -21,7 +21,7 @@ extension TreeSet { /// Calling this method invalidates all existing indices of the collection. /// /// - Parameter position: The index of the member to remove. `position` must - /// be a valid index of the set, and it must not be equal to the set’s + /// be a valid index of the set, and it must not be equal to the set's /// end index. /// - Returns: The element that was removed from the set. /// - Complexity: O(log(`count`)) if set storage might be shared; O(1) diff --git a/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Elements.SubSequence.swift b/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Elements.SubSequence.swift index 975254205..3b64464a3 100644 --- a/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Elements.SubSequence.swift +++ b/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Elements.SubSequence.swift @@ -103,7 +103,7 @@ extension OrderedDictionary.Elements.SubSequence { } extension OrderedDictionary.Elements.SubSequence: Sequence { - // A type representing the collection’s elements. + // A type representing the collection's elements. public typealias Element = OrderedDictionary.Element /// The type that allows iteration over the collection's elements. diff --git a/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Values.swift b/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Values.swift index 7aeabeb2b..d172965ca 100644 --- a/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Values.swift +++ b/Sources/OrderedCollections/OrderedDictionary/OrderedDictionary+Values.swift @@ -273,7 +273,7 @@ extension OrderedDictionary.Values: RandomAccessCollection { end - start } - /// Call `body(p)`, where `p` is a buffer pointer to the collection’s + /// Call `body(p)`, where `p` is a buffer pointer to the collection's /// contiguous storage. `OrderedDictionary.Values` values always have /// contiguous storage. /// diff --git a/Sources/OrderedCollections/OrderedSet/OrderedSet+RandomAccessCollection.swift b/Sources/OrderedCollections/OrderedSet/OrderedSet+RandomAccessCollection.swift index 9539b8414..82446bbba 100644 --- a/Sources/OrderedCollections/OrderedSet/OrderedSet+RandomAccessCollection.swift +++ b/Sources/OrderedCollections/OrderedSet/OrderedSet+RandomAccessCollection.swift @@ -43,7 +43,7 @@ extension OrderedSet: Sequence { return (Iterator(_elements: self, _position: copied), copied) } - /// Call `body(p)`, where `p` is a buffer pointer to the collection’s + /// Call `body(p)`, where `p` is a buffer pointer to the collection's /// contiguous storage. Ordered sets always have contiguous storage. /// /// - Parameter body: A function to call. The function must not escape its diff --git a/Sources/OrderedCollections/OrderedSet/OrderedSet+SubSequence.swift b/Sources/OrderedCollections/OrderedSet/OrderedSet+SubSequence.swift index e80a699f1..f40622d91 100644 --- a/Sources/OrderedCollections/OrderedSet/OrderedSet+SubSequence.swift +++ b/Sources/OrderedCollections/OrderedSet/OrderedSet+SubSequence.swift @@ -70,7 +70,7 @@ extension OrderedSet.SubSequence: CustomDebugStringConvertible { #endif extension OrderedSet.SubSequence: Sequence { - // A type representing the collection’s elements. + // A type representing the collection's elements. public typealias Element = OrderedSet.Element /// The type that allows iteration over the collection's elements. public typealias Iterator = IndexingIterator @@ -104,7 +104,7 @@ extension OrderedSet.SubSequence: Sequence { copied) } - /// Call `body(p)`, where `p` is a buffer pointer to the collection’s + /// Call `body(p)`, where `p` is a buffer pointer to the collection's /// contiguous storage. Ordered sets always have contiguous storage. /// /// - Parameter body: A function to call. The function must not escape its diff --git a/Sources/SortedCollections/SortedDictionary/SortedDictionary+Initializers.swift b/Sources/SortedCollections/SortedDictionary/SortedDictionary+Initializers.swift index 68fe70fb8..95129d2b3 100644 --- a/Sources/SortedCollections/SortedDictionary/SortedDictionary+Initializers.swift +++ b/Sources/SortedCollections/SortedDictionary/SortedDictionary+Initializers.swift @@ -114,7 +114,7 @@ extension SortedDictionary { /// by the given closure and whose values are arrays of the elements that /// returned each key. /// - /// The arrays in the “values” position of the new sorted dictionary each contain at least + /// The arrays in the "values" position of the new sorted dictionary each contain at least /// one element, with the elements in the same order as the source sequence. /// The following example declares an array of names, and then creates a sorted dictionary /// from that array by grouping the names by first letter: @@ -123,7 +123,7 @@ extension SortedDictionary { /// let studentsByLetter = SortedDictionary(grouping: students, by: { $0.first! }) /// // ["A": ["Abena", "Akosua"], "E": ["Efua"], "K": ["Kofi", "Kweku"]] /// - /// The new `studentsByLetter` sorted dictionary has three entries, with students’ names + /// The new `studentsByLetter` sorted dictionary has three entries, with students' names /// grouped by the keys `"A"`, `"E"`, and `"K"` /// /// diff --git a/Sources/SortedCollections/SortedDictionary/SortedDictionary+Partial RangeReplaceableCollection.swift b/Sources/SortedCollections/SortedDictionary/SortedDictionary+Partial RangeReplaceableCollection.swift index 5e2d1b693..7cb12c71f 100644 --- a/Sources/SortedCollections/SortedDictionary/SortedDictionary+Partial RangeReplaceableCollection.swift +++ b/Sources/SortedCollections/SortedDictionary/SortedDictionary+Partial RangeReplaceableCollection.swift @@ -130,7 +130,7 @@ extension SortedDictionary { /// /// - Parameter index: The position of the key-value pair to remove. `index` /// must be a valid index of the sorted dictionary, and must not equal the sorted - /// dictionary’s end index. + /// dictionary's end index. /// - Returns: The key-value pair that correspond to `index`. /// - Complexity: O(`log n`) where `n` is the number of key-value pairs in the /// sorted dictionary. diff --git a/Sources/SortedCollections/SortedDictionary/SortedDictionary+Subscripts.swift b/Sources/SortedCollections/SortedDictionary/SortedDictionary+Subscripts.swift index bff3c26db..aa0d26f46 100644 --- a/Sources/SortedCollections/SortedDictionary/SortedDictionary+Subscripts.swift +++ b/Sources/SortedCollections/SortedDictionary/SortedDictionary+Subscripts.swift @@ -18,7 +18,7 @@ extension SortedDictionary { /// the dictionary, or nil if the key is not found. /// /// When you assign a value for a key and that key already exists, the dictionary overwrites - /// the existing value. If the dictionary doesn’t contain the key, the key and value are added + /// the existing value. If the dictionary doesn't contain the key, the key and value are added /// as a new key-value pair. /// /// - Parameter key: The key to find in the dictionary. @@ -72,7 +72,7 @@ extension SortedDictionary { } } - /// Accesses the value with the given key. If the dictionary doesn’t contain the given + /// Accesses the value with the given key. If the dictionary doesn't contain the given /// key, accesses the provided default value as if the key and default value existed /// in the dictionary. /// @@ -81,7 +81,7 @@ extension SortedDictionary { /// /// - Parameters: /// - key: The key the look up in the dictionary. - /// - defaultValue: The default value to use if key doesn’t exist in the dictionary. + /// - defaultValue: The default value to use if key doesn't exist in the dictionary. /// - Returns: The value associated with key in the dictionary; otherwise, defaultValue. /// - Complexity: O(`log n`) @inlinable diff --git a/Sources/SortedCollections/SortedDictionary/SortedDictionary.swift b/Sources/SortedCollections/SortedDictionary/SortedDictionary.swift index 1439ded90..64373e482 100644 --- a/Sources/SortedCollections/SortedDictionary/SortedDictionary.swift +++ b/Sources/SortedCollections/SortedDictionary/SortedDictionary.swift @@ -141,7 +141,7 @@ extension SortedDictionary { /// - value: The new value to add to the dictionary. /// - key: The key to associate with value. If key already exists in the /// dictionary, value replaces the existing associated value. If key - /// isn’t already a key of the dictionary, the `(key, value)` pair + /// isn't already a key of the dictionary, the `(key, value)` pair /// is added. /// - Returns: The value that was replaced, or nil if a new key-value /// pair was added. diff --git a/Sources/SortedCollections/SortedSet/SortedSet+Partial RangeReplaceableCollection.swift b/Sources/SortedCollections/SortedSet/SortedSet+Partial RangeReplaceableCollection.swift index 22c19c501..35a30b62b 100644 --- a/Sources/SortedCollections/SortedSet/SortedSet+Partial RangeReplaceableCollection.swift +++ b/Sources/SortedCollections/SortedSet/SortedSet+Partial RangeReplaceableCollection.swift @@ -130,7 +130,7 @@ extension SortedSet { /// /// - Parameter index: The position of the key-value pair to remove. `index` /// must be a valid index of the sorted dictionary, and must not equal the sorted - /// dictionary’s end index. + /// dictionary's end index. /// - Returns: The key-value pair that correspond to `index`. /// - Complexity: O(`log n`) where `n` is the number of members in the /// sorted set.