coveo::linq
Implementation of .NET-like LINQ operators in C++
|
Returns first element in a sequence, or a default value. More...
Functions | |
template<typename = void> | |
auto | coveo::linq::first_or_default () -> detail::first_or_default_impl_0<> |
Returns first element in sequence, or default value. More... | |
template<typename Pred > | |
auto | coveo::linq::first_or_default (const Pred &pred) -> detail::first_or_default_impl_1< Pred > |
Returns first element in sequence that satisfy predicate, or default value. More... | |
The first_or_default
operator returns the first element in a sequence, or the first element to satisfy a predicate. If the sequence does not have such an element, a default value is returned.
This is a terminal operator.
.NET equivalent: FirstOrDefault
auto coveo::linq::first_or_default | ( | ) | -> detail::first_or_default_impl_0<> |
Returns the first element in a sequence. If the sequence does not have elements, a default-initialized value is returned instead.
Use like this:
auto coveo::linq::first_or_default | ( | const Pred & | pred | ) | -> detail::first_or_default_impl_1<Pred> |
Returns the first element in a sequence for which the given predicate returns true
. If the sequence does not have elements or does not contain an element that satisfy the predicate, a default-initialized value is returned instead.
Use like this:
pred | Predicate to satisfy. |
pred
returns true
or, if no such element exists in sequence, a default value.