add identity operator

This commit is contained in:
Guillaume Lessard committed 2024-07-24 17:04:37 -07:00
1 parent e5a2570b79
commit 80c67c2eff
2 files changed
+18

No files matched your search

+9
View File
@@ -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.
+9
View File
@@ -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.