stdlib: de-underscore sort() and partition() methods

Swift SVN r28839
This commit is contained in:
Dmitri Hrybenko
2015-05-20 19:34:36 +00:00
parent 280d6b8d49
commit fe239e3d03
21 changed files with 87 additions and 175 deletions

View File

@@ -675,26 +675,16 @@ extension ${Self} : _ArrayType {
return Swift.join(self, elements)
}
/// Sort `self` in-place according to `isOrderedBefore`.
///
/// - Requires: `isOrderedBefore` induces a [strict weak ordering](http://en.wikipedia.org/wiki/Strict_weak_order#Strict_weak_orderings)
/// over the elements.
public mutating func sort(isOrderedBefore: (T, T) -> Bool) {
return withUnsafeMutableBufferPointer {
me in Swift.sort(&me, isOrderedBefore)
return
}
}
/// Returns a copy of `self` that has been sorted according to
/// `isOrderedBefore`.
///
/// - Requires: `isOrderedBefore` induces a
/// [strict weak ordering](http://en.wikipedia.org/wiki/Strict_weak_order#Strict_weak_orderings)
/// over the elements.
@available(*, unavailable, message="call the 'sort()' method on the array")
public func sorted(isOrderedBefore: (T, T) -> Bool) -> ${Self} {
var result = self
result.sort(isOrderedBefore)
result.sortInPlace(isOrderedBefore)
return result
}
}