mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #5723 from natecook1000/nc-fixes-05
This commit is contained in:
@@ -671,6 +671,8 @@ public struct Set<Element : Hashable> :
|
||||
}
|
||||
|
||||
/// The number of elements in the set.
|
||||
///
|
||||
/// - Complexity: O(1).
|
||||
public var count: Int {
|
||||
return _variantBuffer.count
|
||||
}
|
||||
@@ -5204,10 +5206,8 @@ extension Set {
|
||||
/// print(attendees.isSubset(of: employees))
|
||||
/// // Prints "true"
|
||||
///
|
||||
/// - Parameter other: A sequence of elements. `possibleSuperset` must be
|
||||
/// finite.
|
||||
/// - Returns: `true` if the set is a subset of `possibleSuperset`;
|
||||
/// otherwise, `false`.
|
||||
/// - Parameter other: Another set.
|
||||
/// - Returns: `true` if the set is a subset of `other`; otherwise, `false`.
|
||||
public func isSubset(of other: Set<Element>) -> Bool {
|
||||
let (isSubset, isEqual) = _compareSets(self, other)
|
||||
return isSubset || isEqual
|
||||
@@ -5224,9 +5224,9 @@ extension Set {
|
||||
/// print(employees.isSuperset(of: attendees))
|
||||
/// // Prints "true"
|
||||
///
|
||||
/// - Parameter possibleSubset: Another set.
|
||||
/// - Returns: `true` if the set is a superset of `possibleSubset`;
|
||||
/// otherwise, `false`.
|
||||
/// - Parameter other: Another set.
|
||||
/// - Returns: `true` if the set is a superset of `other`; otherwise,
|
||||
/// `false`.
|
||||
public func isSuperset(of other: Set<Element>) -> Bool {
|
||||
return other.isSubset(of: self)
|
||||
}
|
||||
@@ -5286,9 +5286,9 @@ extension Set {
|
||||
/// print(employees.isStrictSuperset(of: employees))
|
||||
/// // Prints "false"
|
||||
///
|
||||
/// - Parameter possibleStrictSubset: Another set.
|
||||
/// - Parameter other: Another set.
|
||||
/// - Returns: `true` if the set is a strict superset of
|
||||
/// `possibleStrictSubset`; otherwise, `false`.
|
||||
/// `other`; otherwise, `false`.
|
||||
public func isStrictSuperset(of other: Set<Element>) -> Bool {
|
||||
return self.isSuperset(of: other) && self != other
|
||||
}
|
||||
@@ -5309,9 +5309,9 @@ extension Set {
|
||||
/// print(attendees.isStrictSubset(of: attendees))
|
||||
/// // Prints "false"
|
||||
///
|
||||
/// - Parameter possibleStrictSuperset: Another set.
|
||||
/// - Parameter other: Another set.
|
||||
/// - Returns: `true` if the set is a strict subset of
|
||||
/// `possibleStrictSuperset`; otherwise, `false`.
|
||||
/// `other`; otherwise, `false`.
|
||||
public func isStrictSubset(of other: Set<Element>) -> Bool {
|
||||
return other.isStrictSuperset(of: self)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user