Skip to content

Commit 78e9e90

Browse files
author
Lance Parker
authored
Merge pull request #17636 from lancep/specialize_remaining
[stdlib]Specialize `remaining` on _CollectionSource
2 parents c60de3c + 6c5ad1c commit 78e9e90

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

stdlib/public/core/NormalizedCodeUnitIterator.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@ struct _NormalizedCodeUnitIterator: IteratorProtocol {
6363
where Source.Element == UInt16, Source.SubSequence == Source
6464
{
6565
var remaining: Int {
66-
return collection.distance(from: index, to: collection.endIndex)
66+
@_specialize(where Source == _UnmanagedString<UInt16>)
67+
@_specialize(where Source == _UnmanagedOpaqueString)
68+
get {
69+
return collection.distance(from: index, to: collection.endIndex)
70+
}
6771
}
6872
var collection: Source
6973
var index: Source.Index

0 commit comments

Comments
 (0)