mirror of
https://github.com/apple/swift-collections
synced 2026-11-27 04:54:21 +00:00
Make the limit optional in Container.nextSpan(after:limitedBy:). Review and update default implementations
- Make `nextSpan(after:limitedBy:)` the core iteration interface - Review default algorithms and update them to use it, speeding them up - Spin off `Span._nextSpan(after:maxCount)` and `Span._nextSpan(after:limitedBy:)` with copying lifetime semantics. This allows forwarding to these without having to override lifetimes.
This commit is contained in:
10 files changed
+193
-131
No files matched your search
@@ -392,6 +392,14 @@ extension UniqueArray where Element: ~Copyable {
|
||||
_storage.nextSpan(after: &index, maxCount: maxCount)
|
||||
}
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
@_lifetime(borrow self)
|
||||
public func nextSpan(
|
||||
after index: inout Int, limitedBy limit: Int?
|
||||
) -> Span<Element> {
|
||||
_storage.nextSpan(after: &index, limitedBy: limit)
|
||||
}
|
||||
|
||||
@inlinable
|
||||
@_lifetime(&self)
|
||||
public mutating func nextMutableSpan(
|
||||
|
||||
Reference in new issue
Block a user