Skip to content

Commit 2874662

Browse files
author
Max Moiseev
committed
[stdlib] Implement _preprocessingPass and _customContainsEquatableElement for StrideTo and StrideThrough
1 parent 4bf1f91 commit 2874662

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

stdlib/public/core/Stride.swift.gyb

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,23 @@ public struct StrideTo<Element : Strideable> : Sequence, CustomReflectable {
233233
return StrideToIterator(_start: _start, end: _end, stride: _stride)
234234
}
235235

236+
@_inlineable
237+
public func _preprocessingPass<R>(
238+
_ preprocess: () throws -> R
239+
) rethrows -> R? {
240+
return try preprocess()
241+
}
242+
243+
@_inlineable
244+
public func _customContainsEquatableElement(
245+
_ element: Element
246+
) -> Bool? {
247+
if element < _start || _end <= element {
248+
return false
249+
}
250+
return nil
251+
}
252+
236253
@_inlineable
237254
@_versioned
238255
internal init(_start: Element, end: Element, stride: Element.Stride) {
@@ -333,6 +350,23 @@ public struct StrideThrough<
333350
return StrideThroughIterator(_start: _start, end: _end, stride: _stride)
334351
}
335352

353+
@_inlineable
354+
public func _preprocessingPass<R>(
355+
_ preprocess: () throws -> R
356+
) rethrows -> R? {
357+
return try preprocess()
358+
}
359+
360+
@_inlineable
361+
public func _customContainsEquatableElement(
362+
_ element: Element
363+
) -> Bool? {
364+
if element < _start || _end < element {
365+
return false
366+
}
367+
return nil
368+
}
369+
336370
@_inlineable
337371
@_versioned
338372
internal init(_start: Element, end: Element, stride: Element.Stride) {

0 commit comments

Comments
 (0)