mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Rename 'subrange' to 'bounds' in non-API arguments
This commit is contained in:
committed by
Max Moiseev
parent
3910a00a35
commit
ab0a2a6044
@@ -275,19 +275,19 @@ extension String.UnicodeScalarView : RangeReplaceableCollection {
|
||||
>(newElements: S) {
|
||||
_core.appendContentsOf(newElements.lazy.flatMap { $0.utf16 })
|
||||
}
|
||||
/// Replace the given `subRange` of elements with `newElements`.
|
||||
/// Replace the elements within `bounds` with `newElements`.
|
||||
///
|
||||
/// Invalidates all indices with respect to `self`.
|
||||
///
|
||||
/// - Complexity: O(`subRange.count`) if `subRange.endIndex
|
||||
/// - Complexity: O(`bounds.count`) if `bounds.endIndex
|
||||
/// == self.endIndex` and `newElements.isEmpty`, O(N) otherwise.
|
||||
public mutating func replaceRange<
|
||||
C: Collection where C.Iterator.Element == UnicodeScalar
|
||||
>(
|
||||
subRange: Range<Index>, with newElements: C
|
||||
bounds: Range<Index>, with newElements: C
|
||||
) {
|
||||
let rawSubRange = subRange.startIndex._position
|
||||
..< subRange.endIndex._position
|
||||
let rawSubRange = bounds.startIndex._position
|
||||
..< bounds.endIndex._position
|
||||
let lazyUTF16 = newElements.lazy.flatMap { $0.utf16 }
|
||||
_core.replaceRange(rawSubRange, with: lazyUTF16)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user