Skip to content

Make documented complexity consistent #223

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 5, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stdlib/public/core/ArrayType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protocol _ArrayType
/// - Postcondition: `capacity >= minimumCapacity` and the array has
/// mutable contiguous storage.
///
/// - Complexity: O(`count`).
/// - Complexity: O(`self.count`).
mutating func reserveCapacity(minimumCapacity: Int)

/// Operator form of `appendContentsOf`.
Expand Down
6 changes: 3 additions & 3 deletions stdlib/public/core/Arrays.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ extension ${Self} : _ArrayType {
/// - Postcondition: `capacity >= minimumCapacity` and the array has
/// mutable contiguous storage.
///
/// - Complexity: O(`count`).
/// - Complexity: O(`self.count`).
@_semantics("array.mutate_unknown")
public mutating func reserveCapacity(minimumCapacity: Int) {
if _buffer.requestUniqueMutableBackingBuffer(minimumCapacity) == nil {
Expand Down Expand Up @@ -722,7 +722,7 @@ extension ${Self} : _ArrayType {
///
/// - Requires: `i <= count`.
///
/// - Complexity: O(`count`).
/// - Complexity: O(`self.count`).
public mutating func insert(newElement: Element, atIndex i: Int) {
_checkIndex(i)
self.replaceRange(i..<i, with: CollectionOfOne(newElement))
Expand All @@ -732,7 +732,7 @@ extension ${Self} : _ArrayType {
///
/// Invalidates all indices with respect to `self`.
///
/// - Complexity: O(`count`).
/// - Complexity: O(`self.count`).
public mutating func removeAtIndex(index: Int) -> Element {
let result = self[index]
self.replaceRange(index..<(index + 1), with: EmptyCollection())
Expand Down
4 changes: 2 additions & 2 deletions stdlib/public/core/HashedCollections.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,7 @@ public struct Dictionary<Key : Hashable, Value> :
///
/// Invalidates all indices with respect to `self`.
///
/// - Complexity: O(`count`).
/// - Complexity: O(`self.count`).
public mutating func removeAtIndex(index: Index) -> Element {
return _variantStorage.removeAtIndex(index)
}
Expand All @@ -1101,7 +1101,7 @@ public struct Dictionary<Key : Hashable, Value> :
/// storage capacity that the collection has, otherwise the underlying
/// storage is released. The default is `false`.
///
/// Complexity: O(`count`).
/// Complexity: O(`self.count`).
public mutating func removeAll(keepCapacity keepCapacity: Bool = false) {
// The 'will not decrease' part in the documentation comment is worded very
// carefully. The capacity can increase if we replace Cocoa storage with
Expand Down