Some confusion about ownership modifiers
Swift Forums
Some confusion about ownership modifiers
Hi everyone. While experimenting with creating a simple Box type in Swift (6.3.3), I've ran into some issues and I'm wondering if you guys could enlighten me. In practice I would use indirect. The code: do { struct Box<T: ~Copyable>: ~Copyable { private let p = UnsafeMutablePointer<T>.allocate(capacity: 1) /* var pointee: T { borrowing get { p.pointee } // Error: 'self.p.pointee' is borrowed and cannot be consumed } */ ...
0 comments
No comments yet.