mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
stdlib: make CollectionType._prext_isEmpty dynamically dispatched
This change makes isEmpty faster for Dictionary and Set, when invoked from generic algorithms. Swift SVN r27736
This commit is contained in:
@@ -18,18 +18,6 @@ GElement = "Generator.Element"
|
||||
|
||||
}%
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// isEmpty
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
extension CollectionType {
|
||||
/// Returns `true` iff `self` is empty.
|
||||
final public var _prext_isEmpty: Bool {
|
||||
// FIXME: dynamic dispatch for Set and Dictionary.
|
||||
return startIndex == endIndex
|
||||
}
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// first
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
Reference in New Issue
Block a user