We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dd3fb9b commit cf09e6bCopy full SHA for cf09e6b
stdlib/public/core/StringUTF8.swift
@@ -492,14 +492,8 @@ extension String.UTF8View.Iterator : IteratorProtocol {
492
extension String.UTF8View {
493
public var count: Int {
494
if _fastPath(_core.isASCII) { return _core.count }
495
- defer { _fixLifetime(_core) }
496
- if _fastPath(_core._unmanagedUTF16 != nil), let b = _core._unmanagedUTF16 {
497
- var result = 0
498
- UTF8._transcode(b, from: UTF16.self) { result += $0.count }
499
- return result
500
- }
501
var result = 0
502
- UTF8._transcode(_core, from: UTF16.self) { result += $0.count }
+ for _ in self { result += 1 }
503
return result
504
}
505
0 commit comments