coveo::linq
Implementation of .NET-like LINQ operators in C++
|
Returns last element in a sequence, or a default value. More...
Functions | |
template<typename = void> | |
auto | coveo::linq::last_or_default () -> detail::last_or_default_impl_0<> |
Returns last element in sequence, or default value. More... | |
template<typename Pred > | |
auto | coveo::linq::last_or_default (const Pred &pred) -> detail::last_or_default_impl_1< Pred > |
Returns last element in sequence that satisfy predicate, or default value. More... | |
The last_or_default
operator returns the last element in a sequence, or the last 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: LastOrDefault
auto coveo::linq::last_or_default | ( | ) | -> detail::last_or_default_impl_0<> |
Returns the last element in a sequence. If the sequence does not have elements, a default-initialized value is returned instead.
Use like this:
auto coveo::linq::last_or_default | ( | const Pred & | pred | ) | -> detail::last_or_default_impl_1<Pred> |
Returns the last 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.