Skip to content

Commit e3effcc

Browse files
committed
[cxx-interop] Allow initializing RangeReplaceableCollection from a C++ container
This makes `Array.init<C: CxxConvertibleToCollection>(C)` more generic by using `RangeReplaceableCollection` protocol instead of concrete `Array` type.
1 parent 34c2b0e commit e3effcc

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

stdlib/public/Cxx/CxxConvertibleToCollection.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ internal func forEachElement<C: CxxConvertibleToCollection>(
3737
}
3838
}
3939

40-
extension Array {
41-
/// Creates an array containing the elements of a C++ container.
40+
extension RangeReplaceableCollection {
41+
/// Creates a collection containing the elements of a C++ container.
4242
///
43-
/// This initializes the array by copying every element of the C++ container.
43+
/// This initializes the collection by copying every element of the C++
44+
/// container.
4445
///
4546
/// - Complexity: O(*n*), where *n* is the number of elements in the C++
4647
/// container when each element is copied in O(1). Note that this might not

0 commit comments

Comments
 (0)