We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 966590d + 6a954f5 commit 201c542Copy full SHA for 201c542
stdlib/public/core/RangeReplaceableCollection.swift
@@ -453,15 +453,10 @@ extension RangeReplaceableCollection {
453
@inlinable
454
public mutating func append<S: Sequence>(contentsOf newElements: __owned S)
455
where S.Element == Element {
456
-
457
- let done:Void? = newElements.withContiguousStorageIfAvailable {
458
- replaceSubrange(endIndex..<endIndex, with: $0)
459
- }
460
461
- if done == nil {
462
- for element in newElements {
463
- append(element)
464
+ let approximateCapacity = self.count + newElements.underestimatedCount
+ self.reserveCapacity(approximateCapacity)
+ for element in newElements {
+ append(element)
465
}
466
467
0 commit comments