Skip to content

Commit 507630e

Browse files
Merge pull request #760 from airspeedswift/se-147
[stdlib] Implement SE-147: Move initialize(from:) from Pointer to BufferPointer
2 parents f808480 + be7901f commit 507630e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Foundation/Data.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1436,7 +1436,11 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
14361436
}
14371437

14381438
if replacementCount != 0 {
1439-
newElements._copyContents(initializing: bytes + start)
1439+
let buf = UnsafeMutableBufferPointer(start: bytes + start,
1440+
count: replacementCount)
1441+
var (it,idx) = newElements._copyContents(initializing: buf)
1442+
precondition(it.next() == nil && idx == buf.endIndex,
1443+
"newElements iterator returned different count to newElements.count")
14401444
}
14411445
}
14421446
}

0 commit comments

Comments
 (0)