Skip to content

Commit 657b418

Browse files
committed
Clarify partitioningIndex(where:) behavior in inline documentation
The returned index isn’t necessarily an index of an element. In the case where it returns `endIndex`, it’s not valid for subscripting the collection. Resolves #170
1 parent 117f43e commit 657b418

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Sources/Algorithms/Partition.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,9 @@ extension MutableCollection where Self: BidirectionalCollection {
168168
//===----------------------------------------------------------------------===//
169169

170170
extension Collection {
171-
/// Returns the index of the first element in the collection that matches
172-
/// the predicate.
171+
/// Returns the start index of the second partition of a collection already
172+
/// partitioned according to the predicate.
173173
///
174-
/// The collection must already be partitioned according to the predicate.
175174
/// That is, there should be an index `i` where for every element in
176175
/// `collection[..<i]` the predicate is `false`, and for every element in
177176
/// `collection[i...]` the predicate is `true`.

0 commit comments

Comments
 (0)