struct Foo {
init(from buffer: Data) {
bar = integer(withBytes: Array(buffer[4..<6]))
baz = integer(withBytes: Array(buffer[6..<8]))
...
}
let d = Data(count: Int(3e+8))
let f = Foo(from: d)
Did I just make two copies of the `Data`? How would I investigate this
to understand it?
I _think_ that if I made it `inout` then it would not make a copy but
now the data buffer is mutable. I want it to be clear I'm not mutating
the buffer inside the initializer but I also want to be sure I'm not
making a copy of the buffer either.
Help?
--
Ryan Lovelett
[email protected]
_______________________________________________
swift-users mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-users