@@ -19,6 +19,7 @@ extension std.string {
1919 ///
2020 /// - Complexity: O(*n*), where *n* is the number of UTF-8 code units in the
2121 /// Swift string.
22+ @inlinable
2223 public init ( _ string: String ) {
2324 self = string. withCString ( encodedAs: UTF8 . self) { buffer in
2425#if os(Windows)
@@ -32,6 +33,7 @@ extension std.string {
3233 }
3334 }
3435
36+ @inlinable
3537 public init ( _ string: UnsafePointer < CChar > ? ) {
3638 if let str = string {
3739#if os(Windows)
@@ -54,6 +56,7 @@ extension std.u16string {
5456 ///
5557 /// - Complexity: O(*n*), where *n* is the number of UTF-16 code units in the
5658 /// Swift string.
59+ @inlinable
5760 public init ( _ string: String ) {
5861 self . init ( )
5962 for char in string. utf16 {
@@ -68,6 +71,7 @@ extension std.u32string {
6871 ///
6972 /// - Complexity: O(*n*), where *n* is the number of UTF-32 code units in the
7073 /// Swift string.
74+ @inlinable
7175 public init ( _ string: String ) {
7276 self . init ( )
7377 for char in string. unicodeScalars {
@@ -79,18 +83,21 @@ extension std.u32string {
7983// MARK: Initializing C++ string from a Swift String literal
8084
8185extension std . string : ExpressibleByStringLiteral {
86+ @inlinable
8287 public init ( stringLiteral value: String ) {
8388 self . init ( value)
8489 }
8590}
8691
8792extension std . u16string : ExpressibleByStringLiteral {
93+ @inlinable
8894 public init ( stringLiteral value: String ) {
8995 self . init ( value)
9096 }
9197}
9298
9399extension std . u32string : ExpressibleByStringLiteral {
100+ @inlinable
94101 public init ( stringLiteral value: String ) {
95102 self . init ( value)
96103 }
@@ -99,14 +106,17 @@ extension std.u32string: ExpressibleByStringLiteral {
99106// MARK: Concatenating and comparing C++ strings
100107
101108extension std . string : Equatable , Comparable {
109+ @inlinable
102110 public static func == ( lhs: std . string , rhs: std . string ) -> Bool {
103111 return lhs. compare ( rhs) == 0
104112 }
105113
114+ @inlinable
106115 public static func < ( lhs: std . string , rhs: std . string ) -> Bool {
107116 return lhs. compare ( rhs) < 0
108117 }
109118
119+ @inlinable
110120 public static func += ( lhs: inout std . string , rhs: std . string ) {
111121 lhs. append ( rhs)
112122 }
@@ -116,6 +126,7 @@ extension std.string: Equatable, Comparable {
116126 __appendUnsafe ( other) // ignore the returned pointer
117127 }
118128
129+ @inlinable
119130 public static func + ( lhs: std . string , rhs: std . string ) -> std . string {
120131 var copy = lhs
121132 copy += rhs
@@ -124,14 +135,17 @@ extension std.string: Equatable, Comparable {
124135}
125136
126137extension std . u16string : Equatable , Comparable {
138+ @inlinable
127139 public static func == ( lhs: std . u16string , rhs: std . u16string ) -> Bool {
128140 return lhs. compare ( rhs) == 0
129141 }
130142
143+ @inlinable
131144 public static func < ( lhs: std . u16string , rhs: std . u16string ) -> Bool {
132145 return lhs. compare ( rhs) < 0
133146 }
134147
148+ @inlinable
135149 public static func += ( lhs: inout std . u16string , rhs: std . u16string ) {
136150 lhs. append ( rhs)
137151 }
@@ -141,6 +155,7 @@ extension std.u16string: Equatable, Comparable {
141155 __appendUnsafe ( other) // ignore the returned pointer
142156 }
143157
158+ @inlinable
144159 public static func + ( lhs: std . u16string , rhs: std . u16string ) -> std . u16string {
145160 var copy = lhs
146161 copy += rhs
@@ -149,14 +164,17 @@ extension std.u16string: Equatable, Comparable {
149164}
150165
151166extension std . u32string : Equatable , Comparable {
167+ @inlinable
152168 public static func == ( lhs: std . u32string , rhs: std . u32string ) -> Bool {
153169 return lhs. compare ( rhs) == 0
154170 }
155171
172+ @inlinable
156173 public static func < ( lhs: std . u32string , rhs: std . u32string ) -> Bool {
157174 return lhs. compare ( rhs) < 0
158175 }
159176
177+ @inlinable
160178 public static func += ( lhs: inout std . u32string , rhs: std . u32string ) {
161179 lhs. append ( rhs)
162180 }
@@ -166,6 +184,7 @@ extension std.u32string: Equatable, Comparable {
166184 __appendUnsafe ( other) // ignore the returned pointer
167185 }
168186
187+ @inlinable
169188 public static func + ( lhs: std . u32string , rhs: std . u32string ) -> std . u32string {
170189 var copy = lhs
171190 copy += rhs
@@ -176,6 +195,7 @@ extension std.u32string: Equatable, Comparable {
176195// MARK: Hashing C++ strings
177196
178197extension std . string : Hashable {
198+ @inlinable
179199 public func hash( into hasher: inout Hasher ) {
180200 // Call std::hash<std::string>::operator()
181201 let cxxHash = __swift_interopHashOfString ( ) . callAsFunction ( self )
@@ -184,6 +204,7 @@ extension std.string: Hashable {
184204}
185205
186206extension std . u16string : Hashable {
207+ @inlinable
187208 public func hash( into hasher: inout Hasher ) {
188209 // Call std::hash<std::u16string>::operator()
189210 let cxxHash = __swift_interopHashOfU16String ( ) . callAsFunction ( self )
@@ -192,6 +213,7 @@ extension std.u16string: Hashable {
192213}
193214
194215extension std . u32string : Hashable {
216+ @inlinable
195217 public func hash( into hasher: inout Hasher ) {
196218 // Call std::hash<std::u32string>::operator()
197219 let cxxHash = __swift_interopHashOfU32String ( ) . callAsFunction ( self )
@@ -202,36 +224,42 @@ extension std.u32string: Hashable {
202224// MARK: Getting a Swift description of a C++ string
203225
204226extension std . string : CustomDebugStringConvertible {
227+ @inlinable
205228 public var debugDescription : String {
206229 return " std.string( \( String ( self ) ) ) "
207230 }
208231}
209232
210233extension std . u16string : CustomDebugStringConvertible {
234+ @inlinable
211235 public var debugDescription : String {
212236 return " std.u16string( \( String ( self ) ) ) "
213237 }
214238}
215239
216240extension std . u32string : CustomDebugStringConvertible {
241+ @inlinable
217242 public var debugDescription : String {
218243 return " std.u32string( \( String ( self ) ) ) "
219244 }
220245}
221246
222247extension std . string : CustomStringConvertible {
248+ @inlinable
223249 public var description : String {
224250 return String ( self )
225251 }
226252}
227253
228254extension std . u16string : CustomStringConvertible {
255+ @inlinable
229256 public var description : String {
230257 return String ( self )
231258 }
232259}
233260
234261extension std . u32string : CustomStringConvertible {
262+ @inlinable
235263 public var description : String {
236264 return String ( self )
237265 }
@@ -247,6 +275,7 @@ extension String {
247275 /// (`"\u{FFFD}"`).
248276 ///
249277 /// - Complexity: O(*n*), where *n* is the number of bytes in the C++ string.
278+ @inlinable
250279 public init ( _ cxxString: std . string ) {
251280 let buffer = UnsafeBufferPointer < CChar > (
252281 start: cxxString. __c_strUnsafe ( ) ,
@@ -265,6 +294,7 @@ extension String {
265294 ///
266295 /// - Complexity: O(*n*), where *n* is the number of bytes in the C++ UTF-16
267296 /// string.
297+ @inlinable
268298 public init ( _ cxxU16String: std . u16string ) {
269299 let buffer = UnsafeBufferPointer < UInt16 > (
270300 start: cxxU16String. __dataUnsafe ( ) ,
@@ -281,6 +311,7 @@ extension String {
281311 ///
282312 /// - Complexity: O(*n*), where *n* is the number of bytes in the C++ UTF-32
283313 /// string.
314+ @inlinable
284315 public init ( _ cxxU32String: std . u32string ) {
285316 let buffer = UnsafeBufferPointer < Unicode . Scalar > (
286317 start: cxxU32String. __dataUnsafe ( ) ,
@@ -303,6 +334,7 @@ extension String {
303334 ///
304335 /// - Complexity: O(*n*), where *n* is the number of bytes in the C++ string
305336 /// view.
337+ @inlinable
306338 public init ( _ cxxStringView: std . string_view ) {
307339 let buffer = UnsafeBufferPointer < CChar > (
308340 start: cxxStringView. __dataUnsafe ( ) ,
@@ -322,6 +354,7 @@ extension String {
322354 ///
323355 /// - Complexity: O(*n*), where *n* is the number of bytes in the C++ UTF-16
324356 /// string view.
357+ @inlinable
325358 public init ( _ cxxU16StringView: std . u16string_view ) {
326359 let buffer = UnsafeBufferPointer < UInt16 > (
327360 start: cxxU16StringView. __dataUnsafe ( ) ,
@@ -339,6 +372,7 @@ extension String {
339372 ///
340373 /// - Complexity: O(*n*), where *n* is the number of bytes in the C++ UTF-32
341374 /// string view.
375+ @inlinable
342376 public init ( _ cxxU32StringView: std . u32string_view ) {
343377 let buffer = UnsafeBufferPointer < Unicode . Scalar > (
344378 start: cxxU32StringView. __dataUnsafe ( ) ,
0 commit comments