Skip to content

Commit 09b6afc

Browse files
author
Dave Abrahams
committed
Merge pull request #829 from kballard/add-complexity-caveats-to-lazy-collections
[Stdlib] Add notes to lazy collection doc comments about complexity
2 parents b50b541 + dee1c7a commit 09b6afc

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

stdlib/public/core/Filter.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,12 @@ public func == <Base : CollectionType>(
148148
/// A lazy `CollectionType` wrapper that includes the elements of an
149149
/// underlying collection that satisfy a predicate.
150150
///
151-
/// - Note: The performance of advancing a `LazyFilterIndex`
152-
/// depends on how sparsely the filtering predicate is satisfied,
153-
/// and may not offer the usual performance given by models of
154-
/// `ForwardIndexType`. Be aware, therefore, that general operations
155-
/// on `LazyFilterCollection` instances may not have the
156-
/// documented complexity.
151+
/// - Note: The performance of accessing `startIndex`, `first`, any methods
152+
/// that depend on `startIndex`, or of advancing a `LazyFilterIndex` depends
153+
/// on how sparsely the filtering predicate is satisfied, and may not offer
154+
/// the usual performance given by `CollectionType` or `ForwardIndexType`. Be
155+
/// aware, therefore, that general operations on `LazyFilterCollection`
156+
/// instances may not have the documented complexity.
157157
public struct LazyFilterCollection<
158158
Base : CollectionType
159159
> : LazyCollectionType {

stdlib/public/core/Flatten.swift.gyb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,14 @@ public func == <BaseElements> (
225225
/// * `c.flatten().map(f)` maps eagerly and returns a new array
226226
/// * `c.lazy.flatten().map(f)` maps lazily and returns a `LazyMapCollection`
227227
///
228+
/// - Note: The performance of accessing `startIndex`, `first`, any methods
229+
/// that depend on `startIndex`, or of advancing a `${Collection}Index`
230+
/// depends on how many empty subcollections are found in the base
231+
/// collection, and may not offer the usual performance given by
232+
/// `CollectionType` or `${traversal}IndexType`. Be aware, therefore, that
233+
/// general operations on `${Collection}` instances may not have the
234+
/// documented complexity.
235+
///
228236
/// - See also: `FlattenSequence`
229237
public struct ${Collection}<
230238
Base: CollectionType where ${constraints % {'Base': 'Base.'}}

0 commit comments

Comments
 (0)