|
|
|
|
|
by meindnoch
1251 days ago
|
|
Ummm… No. Swift structs are just like C structs (from a memory perspective). The copy-on-write thing is implemented manually by storing a private refcounted object in your struct. See the implementation of Array for example: https://github.com/apple/swift/blob/main/stdlib/public/core/... There’s no magical copy-on-write mechanism at the language level. |
|