mirror of
https://github.com/apple/swift-collections
synced 2026-11-25 04:37:48 +00:00
Add subscript requirements to [Mutable]Container with borrow/mutate accessors
This commit is contained in:
11 files changed
+59
-41
No files matched your search
@@ -114,12 +114,13 @@ extension UniqueArray where Element: ~Copyable {
|
||||
@inlinable
|
||||
public subscript(position: Int) -> Element {
|
||||
@inline(__always)
|
||||
unsafeAddress {
|
||||
_storage._ptr(to: position)
|
||||
borrow {
|
||||
_storage[position]
|
||||
}
|
||||
@inline(__always)
|
||||
unsafeMutableAddress {
|
||||
_storage._mutablePtr(to: position)
|
||||
@_unsafeSelfDependentResult // FIXME: Why is this necessary?
|
||||
mutate {
|
||||
&_storage[position]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user