Skip to content

Commit dd5ba51

Browse files
author
Max Moiseev
committed
[stdlib] Implement _customContainsEquatableElement for LazySequence and LazyXCollection
1 parent 2874662 commit dd5ba51

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

stdlib/public/core/Filter.swift.gyb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,16 @@ public struct LazyFilterSequence<Base : Sequence>
8484
_base: base.makeIterator(), _include)
8585
}
8686

87+
@_inlineable
88+
public func _customContainsEquatableElement(
89+
_ element: Element
90+
) -> Bool? {
91+
if !_include(element) {
92+
return false
93+
}
94+
return nil
95+
}
96+
8797
/// Creates an instance consisting of the elements `x` of `base` for
8898
/// which `isIncluded(x) == true`.
8999
@_inlineable // FIXME(sil-serialize-all)
@@ -152,6 +162,16 @@ public struct ${Self}<
152162
self._predicate = isIncluded
153163
}
154164

165+
@_inlineable
166+
public func _customContainsEquatableElement(
167+
_ element: Element
168+
) -> Bool? {
169+
if !_predicate(element) {
170+
return false
171+
}
172+
return nil
173+
}
174+
155175
/// The position of the first element in a non-empty collection.
156176
///
157177
/// In an empty collection, `startIndex == endIndex`.

0 commit comments

Comments
 (0)