@@ -936,7 +936,7 @@ extension ${Self} : ArrayLiteralConvertible {
936
936
///
937
937
/// - Parameter elements: A variadic list of elements of the new array.
938
938
public init ( arrayLiteral elements: Element ... ) {
939
- self . init ( _buffer: _extractOrCopyToContiguousArray ( elements. _buffer ) . _buffer)
939
+ self . init ( _buffer: ContiguousArray ( elements) . _buffer)
940
940
}
941
941
% end
942
942
}
@@ -1428,7 +1428,10 @@ extension ${Self} : RangeReplaceableCollection, _ArrayProtocol {
1428
1428
}
1429
1429
1430
1430
public func _copyToContiguousArray( ) -> ContiguousArray < Element > {
1431
- return _extractOrCopyToContiguousArray ( self . _buffer)
1431
+ if let n = _buffer. requestNativeBuffer ( ) {
1432
+ return ContiguousArray ( _buffer: n)
1433
+ }
1434
+ return _copyCollectionToContiguousArray ( _buffer)
1432
1435
}
1433
1436
}
1434
1437
@@ -1488,10 +1491,9 @@ extension ${Self} {
1488
1491
if _fastPath ( p != nil || isEmpty) {
1489
1492
return ( _owner, UnsafePointer ( p) )
1490
1493
}
1491
- let n = _extractOrCopyToNativeArrayBuffer ( self . _buffer)
1494
+ let n = ContiguousArray ( self . _buffer) . _buffer
1492
1495
return ( n. owner, UnsafePointer ( n. firstElementAddress) )
1493
1496
}
1494
-
1495
1497
}
1496
1498
1497
1499
extension ${ Self} {
@@ -1977,29 +1979,6 @@ internal func _arrayReserve<_Buffer>(
1977
1979
_arrayOutOfPlaceUpdate ( & buffer, & newBuffer, count, 0 , _IgnorePointer ( ) )
1978
1980
}
1979
1981
1980
- internal func _extractOrCopyToContiguousArray< Buffer> (
1981
- _ source: Buffer
1982
- ) -> ContiguousArray < Buffer . Iterator . Element >
1983
- where
1984
- Buffer : _ArrayBufferProtocol ,
1985
- Buffer. Iterator. Element == Buffer . Element {
1986
-
1987
- if let n = source. requestNativeBuffer ( ) {
1988
- return ContiguousArray ( _buffer: n)
1989
- }
1990
- return _copyCollectionToContiguousArray ( source)
1991
- }
1992
-
1993
- internal func _extractOrCopyToNativeArrayBuffer< Buffer> (
1994
- _ source: Buffer
1995
- ) -> _ContiguousArrayBuffer < Buffer . Iterator . Element >
1996
- where
1997
- Buffer : _ArrayBufferProtocol ,
1998
- Buffer. Iterator. Element == Buffer . Element {
1999
-
2000
- return _extractOrCopyToContiguousArray ( source) . _buffer
2001
- }
2002
-
2003
1982
/// Append items from `newItems` to `buffer`.
2004
1983
internal func _arrayAppendSequence< Buffer, S> (
2005
1984
_ buffer: inout Buffer , _ newItems: S
0 commit comments