Skip to content

Commit

Permalink
Merge pull request swiftlang#829 from kballard/add-complexity-caveats…
Browse files Browse the repository at this point in the history
…-to-lazy-collections

[Stdlib] Add notes to lazy collection doc comments about complexity
  • Loading branch information
Dave Abrahams committed Dec 31, 2015
2 parents b50b541 + dee1c7a commit 09b6afc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
12 changes: 6 additions & 6 deletions stdlib/public/core/Filter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ public func == <Base : CollectionType>(
/// A lazy `CollectionType` wrapper that includes the elements of an
/// underlying collection that satisfy a predicate.
///
/// - Note: The performance of advancing a `LazyFilterIndex`
/// depends on how sparsely the filtering predicate is satisfied,
/// and may not offer the usual performance given by models of
/// `ForwardIndexType`. Be aware, therefore, that general operations
/// on `LazyFilterCollection` instances may not have the
/// documented complexity.
/// - Note: The performance of accessing `startIndex`, `first`, any methods
/// that depend on `startIndex`, or of advancing a `LazyFilterIndex` depends
/// on how sparsely the filtering predicate is satisfied, and may not offer
/// the usual performance given by `CollectionType` or `ForwardIndexType`. Be
/// aware, therefore, that general operations on `LazyFilterCollection`
/// instances may not have the documented complexity.
public struct LazyFilterCollection<
Base : CollectionType
> : LazyCollectionType {
Expand Down
8 changes: 8 additions & 0 deletions stdlib/public/core/Flatten.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,14 @@ public func == <BaseElements> (
/// * `c.flatten().map(f)` maps eagerly and returns a new array
/// * `c.lazy.flatten().map(f)` maps lazily and returns a `LazyMapCollection`
///
/// - Note: The performance of accessing `startIndex`, `first`, any methods
/// that depend on `startIndex`, or of advancing a `${Collection}Index`
/// depends on how many empty subcollections are found in the base
/// collection, and may not offer the usual performance given by
/// `CollectionType` or `${traversal}IndexType`. Be aware, therefore, that
/// general operations on `${Collection}` instances may not have the
/// documented complexity.
///
/// - See also: `FlattenSequence`
public struct ${Collection}<
Base: CollectionType where ${constraints % {'Base': 'Base.'}}
Expand Down

0 comments on commit 09b6afc

Please sign in to comment.