File tree Expand file tree Collapse file tree 3 files changed +60
-0
lines changed Expand file tree Collapse file tree 3 files changed +60
-0
lines changed Original file line number Diff line number Diff line change @@ -2136,3 +2136,23 @@ internal struct _ArrayAnyHashableBox<Element: Hashable>
2136
2136
}
2137
2137
2138
2138
extension Array : @unchecked Sendable where Element: Sendable { }
2139
+
2140
+ extension Array {
2141
+ /// Returns a boolean value indicating whether this array is identical to
2142
+ /// `other`.
2143
+ ///
2144
+ /// Two array values are identical if there is no way to distinguish between
2145
+ /// them.
2146
+ ///
2147
+ /// Comparing arrays this way includes comparing (normally) hidden
2148
+ /// implementation details such as the memory location of any underlying
2149
+ /// array storage object. Therefore, identical arrays are guaranteed to
2150
+ /// compare equal with `==`, but not all equal arrays are considered
2151
+ /// identical.
2152
+ ///
2153
+ /// - Performance: O(1)
2154
+ @backDeployed ( before: SwiftStdlib 6.3 )
2155
+ public func isIdentical( to other: Self ) -> Bool {
2156
+ self . _buffer. identity == other. _buffer. identity
2157
+ }
2158
+ }
Original file line number Diff line number Diff line change @@ -1586,3 +1586,23 @@ extension ArraySlice {
1586
1586
}
1587
1587
}
1588
1588
#endif
1589
+
1590
+ extension ArraySlice {
1591
+ /// Returns a boolean value indicating whether this array is identical to
1592
+ /// `other`.
1593
+ ///
1594
+ /// Two array values are identical if there is no way to distinguish between
1595
+ /// them.
1596
+ ///
1597
+ /// Comparing arrays this way includes comparing (normally) hidden
1598
+ /// implementation details such as the memory location of any underlying
1599
+ /// array storage object. Therefore, identical arrays are guaranteed to
1600
+ /// compare equal with `==`, but not all equal arrays are considered
1601
+ /// identical.
1602
+ ///
1603
+ /// - Performance: O(1)
1604
+ @backDeployed ( before: SwiftStdlib 6.3 )
1605
+ public func isIdentical( to other: Self ) -> Bool {
1606
+ self . _buffer. identity == other. _buffer. identity
1607
+ }
1608
+ }
Original file line number Diff line number Diff line change @@ -1495,3 +1495,23 @@ extension ContiguousArray {
1495
1495
1496
1496
extension ContiguousArray : @unchecked Sendable
1497
1497
where Element: Sendable { }
1498
+
1499
+ extension ContiguousArray {
1500
+ /// Returns a boolean value indicating whether this array is identical to
1501
+ /// `other`.
1502
+ ///
1503
+ /// Two array values are identical if there is no way to distinguish between
1504
+ /// them.
1505
+ ///
1506
+ /// Comparing arrays this way includes comparing (normally) hidden
1507
+ /// implementation details such as the memory location of any underlying
1508
+ /// array storage object. Therefore, identical arrays are guaranteed to
1509
+ /// compare equal with `==`, but not all equal arrays are considered
1510
+ /// identical.
1511
+ ///
1512
+ /// - Performance: O(1)
1513
+ @backDeployed ( before: SwiftStdlib 6.3 )
1514
+ public func isIdentical( to other: Self ) -> Bool {
1515
+ self . _buffer. identity == other. _buffer. identity
1516
+ }
1517
+ }
You can’t perform that action at this time.
0 commit comments