Creates an array with the specified capacity, then calls the given closure with a buffer covering the array’s uninitialized memory.
- Xcode 11.0+Beta
- Swift Standard Library
The number of elements to allocate space for in the new array.
Inside the closure, set the
initialized parameter to the number of elements that are initialized by the closure. The memory in the range
buffer[0..<initialized must be initialized at the end of the closure’s execution, and the memory in the range
buffer[initialized must be uninitialized. This postcondition must hold even if the
initializer closure throws an error.