mirror of
https://github.com/apple/swift-collections
synced 2026-11-30 05:18:44 +00:00
add identity operator
This commit is contained in:
1 parent
e5a2570b79
commit
80c67c2eff
2 files changed
+18
No files matched your search
@@ -111,6 +111,15 @@ extension RawSpan {
|
||||
}
|
||||
}
|
||||
|
||||
extension RawSpan {
|
||||
/// Returns a Boolean value indicating whether two `RawSpan` instances
|
||||
/// refer to the same region in memory.
|
||||
@inlinable @inline(__always)
|
||||
public static func ===(_ a: Self, _ b: Self) -> Bool {
|
||||
(a._pointer == b._pointer) && (a._count == b._count)
|
||||
}
|
||||
}
|
||||
|
||||
extension RawSpan {
|
||||
|
||||
/// The number of bytes in the span.
|
||||
|
||||
@@ -328,6 +328,15 @@ extension Span where Element: Equatable {
|
||||
}
|
||||
}
|
||||
|
||||
extension Span where Element: ~Copyable /*& ~Escapable*/ {
|
||||
/// Returns a Boolean value indicating whether two `RawSpan` instances
|
||||
/// refer to the same region in memory.
|
||||
@inlinable @inline(__always)
|
||||
public static func ===(_ a: Self, _ b: Self) -> Bool {
|
||||
(a._pointer == b._pointer) && (a._count == b._count)
|
||||
}
|
||||
}
|
||||
|
||||
extension Span where Element: ~Copyable /*& ~Escapable*/ {
|
||||
|
||||
/// The number of elements in the span.
|
||||
|
||||
Reference in new issue
Block a user