File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 11
11
//===----------------------------------------------------------------------===//
12
12
13
13
extension std . string {
14
+ /// Creates a C++ string having the same content as the given Swift string.
15
+ ///
16
+ /// - Complexity: O(*n*), where *n* is the number of UTF-8 code units in the
17
+ /// Swift string.
14
18
public init ( _ string: String ) {
15
19
self . init ( )
16
20
for char in string. utf8 {
@@ -26,6 +30,13 @@ extension std.string: ExpressibleByStringLiteral {
26
30
}
27
31
28
32
extension String {
33
+ /// Creates a String having the same content as the given C++ string.
34
+ ///
35
+ /// If `cxxString` contains ill-formed UTF-8 code unit sequences, this
36
+ /// initializer replaces them with the Unicode replacement character
37
+ /// (`"\u{FFFD}"`).
38
+ ///
39
+ /// - Complexity: O(*n*), where *n* is the number of bytes in the C++ string.
29
40
public init ( cxxString: std . string ) {
30
41
let buffer = UnsafeBufferPointer < CChar > (
31
42
start: cxxString. __c_strUnsafe ( ) ,
You can’t perform that action at this time.
0 commit comments