[swift-users] Why does the withUnsafeMutableBufferPointer closure take an inout parameter?
martinr448 at gmail.com
Sun Oct 8 14:14:26 CDT 2017
I wonder why the closure in the Array method
mutating func withUnsafeMutableBufferPointer<R>(_ body: (inout UnsafeMutableBufferPointer<Array.Element>) throws -> R) rethrows -> R
takes an _inout_ parameter. The closure is called with a pointer to the contiguous array storage, and I fail to imagine an example where it makes sense to assign a new value to the parameter.
Any insights are welcome!
More information about the swift-users