@@ -191,27 +191,27 @@ extension VLArray where Element: ~Copyable {
191191extension VLArray {
192192 @discardableResult
193193 @inlinable
194- public static func create< T> (
194+ public static func create< T: ~ Copyable > (
195195 amount: Int ,
196196 default: Element ,
197- _ closure : ( consuming Self ) throws -> T
197+ _ body : ( consuming Self ) throws -> T
198198 ) rethrows -> T {
199199 return try withUnsafeTemporaryAllocation ( of: Element . self, capacity: amount, { p in
200200 p. initialize ( repeating: `default`)
201201 defer {
202202 p. deinitialize ( )
203203 }
204204 let array = Self ( _storage: p)
205- return try closure ( array)
205+ return try body ( array)
206206 } )
207207 }
208208
209209 @discardableResult
210210 @inlinable
211- public static func create< T> (
211+ public static func create< T: ~ Copyable > (
212212 amount: Int ,
213213 initialize: ( Index ) -> Element ,
214- _ closure : ( consuming Self ) throws -> T
214+ _ body : ( consuming Self ) throws -> T
215215 ) rethrows -> T {
216216 return try withUnsafeTemporaryAllocation ( of: Element . self, capacity: amount, { p in
217217 for i in 0 ..< amount {
@@ -221,7 +221,7 @@ extension VLArray {
221221 p. deinitialize ( )
222222 }
223223 let array = Self ( _storage: p)
224- return try closure ( array)
224+ return try body ( array)
225225 } )
226226 }
227227}
@@ -230,10 +230,10 @@ extension VLArray {
230230extension VLArray where Element: ~ Copyable {
231231 @discardableResult
232232 @inlinable
233- public static func create< T> (
233+ public static func create< T : ~ Copyable > (
234234 amount: Int,
235235 initialize: ( Index) - > Element,
236- _ closure : ( consuming Self ) throws -> T
236+ _ body : ( consuming Self) throws -> T
237237 ) rethrows -> T {
238238 return try withUnsafeTemporaryAllocation ( of: Element . self, capacity: amount, { p in
239239 for i in 0 ..< amount {
@@ -243,7 +243,7 @@ extension VLArray where Element: ~Copyable {
243243 p. deinitialize ( )
244244 }
245245 let array = Self ( _storage: p)
246- return try closure ( array)
246+ return try body ( array)
247247 } )
248248 }
249249}
@@ -253,9 +253,9 @@ extension VLArray where Element == UInt8 {
253253
254254 @discardableResult
255255 @inlinable
256- public static func create< T> (
256+ public static func create< T: ~ Copyable > (
257257 string: StaticString ,
258- _ closure : ( consuming Self ) throws -> T
258+ _ body : ( consuming Self ) throws -> T
259259 ) rethrows -> T {
260260 return try withUnsafeTemporaryAllocation ( of: Element . self, capacity: string. utf8CodeUnitCount, { p in
261261 string. withUTF8Buffer {
@@ -265,15 +265,15 @@ extension VLArray where Element == UInt8 {
265265 p. deinitialize ( )
266266 }
267267 let array = Self ( _storage: p)
268- return try closure ( array)
268+ return try body ( array)
269269 } )
270270 }
271271
272272 @discardableResult
273273 @inlinable
274- public static func create< T> (
274+ public static func create< T: ~ Copyable > (
275275 string: some StringProtocol ,
276- _ closure : ( consuming Self ) throws -> T
276+ _ body : ( consuming Self ) throws -> T
277277 ) rethrows -> T {
278278 let utf8 = string. utf8
279279 return try withUnsafeTemporaryAllocation ( of: Element . self, capacity: utf8. count, { p in
@@ -282,15 +282,15 @@ extension VLArray where Element == UInt8 {
282282 p. deinitialize ( )
283283 }
284284 let array = Self ( _storage: p)
285- return try closure ( array)
285+ return try body ( array)
286286 } )
287287 }
288288
289289 @discardableResult
290290 @inlinable
291- public static func create< T> (
291+ public static func create< T: ~ Copyable > (
292292 collection: some Collection < UInt8 > ,
293- _ closure : ( consuming Self ) throws -> T
293+ _ body : ( consuming Self ) throws -> T
294294 ) rethrows -> T {
295295 let count = collection. count
296296 return try withUnsafeTemporaryAllocation (
@@ -302,33 +302,7 @@ extension VLArray where Element == UInt8 {
302302 p. deinitialize ( )
303303 }
304304 let array = Self ( _storage: p)
305- return try closure ( array)
305+ return try body ( array)
306306 }
307307 }
308- }
309-
310- // MARK: Join
311- #if compiler(>=6.2)
312- extension VLArray {
313- @inlinable
314- public func join< let count: Int > (
315- _ arrays: consuming InlineArray < count , VLArray > ,
316- _ closure: ( inout Joined ) throws -> Void
317- ) rethrows {
318- try withUnsafeTemporaryAllocation (
319- of: UnsafeMutableBufferPointer< Element> . self ,
320- capacity: 1 + count
321- ) { p in
322- p. initializeElement ( at: 0 , to: self . _storage)
323- for i in arrays. indices {
324- p. initializeElement ( at: 1 + i, to: arrays [ i] . _storage)
325- }
326- defer {
327- p. deinitialize ( )
328- }
329- var joined = Joined . init ( _storage: p)
330- try closure ( & joined)
331- }
332- }
333- }
334- #endif
308+ }
0 commit comments