Array.swift
1 extension Array { 2 /// Creates an empty array with the given capacity. 3 /// 4 /// It will be empty (i.e. `count == 0`), but the array will be able have at 5 /// least `capacity` elements inserted into it without reallocating. 6 /// 7 /// This API should be used with care. You should know that you will 8 /// actually fill the array with precisely this number of elements. 9 /// 10 @inlinable 11 @inline(__always) 12 public init(capacity: Int) { 13 self.init(unsafeUninitializedCapacity: capacity) { _, initializedCount in 14 initializedCount = 0 15 } 16 } 17 }