Add isTriviallyIdentical for unicode views

This commit is contained in:
WindowsMEMZ
2025-10-28 18:56:18 +08:00
committed by Rick van Voorden
parent c8202c6f9a
commit be5ec1aed4
4 changed files with 69 additions and 0 deletions

View File

@@ -1056,3 +1056,14 @@ extension String.UTF16View {
}
}
}
extension String.UTF16View {
/// Returns a boolean value indicating whether this UTF16 view
/// is trivially identical to `other`.
///
/// - Complexity: O(1)
@_alwaysEmitIntoClient
public func isTriviallyIdentical(to other: Self) -> Bool {
self._guts.rawBits == other._guts.rawBits
}
}