coveo::linq
Implementation of .NET-like LINQ operators in C++
|
Returns first element in a sequence. More...
Functions | |
template<typename = void> | |
auto | coveo::linq::first () -> detail::first_impl_0<> |
Returns first element in sequence. More... | |
template<typename Pred > | |
auto | coveo::linq::first (const Pred &pred) -> detail::first_impl_1< Pred > |
Returns first element in sequence that satisfy predicate. More... | |
The first
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, an exception is thrown.
This is a terminal operator.
.NET equivalent: First
auto coveo::linq::first | ( | ) | -> detail::first_impl_0<> |
Returns the first element in a sequence. If the sequence does not have elements, coveo::linq::empty_sequence
is thrown.
Use like this:
coveo::linq::empty_sequence | The sequence does not have elements. |
auto coveo::linq::first | ( | const Pred & | pred | ) | -> detail::first_impl_1<Pred> |
Returns the first element in a sequence for which the given predicate returns true
. If the sequence does not have elements, coveo::linq::empty_sequence
is thrown; if the sequence does not contain an element that satisfy the predicate, coveo::linq::out_of_range
is thrown.
Use like this:
pred | Predicate to satisfy. |
pred
returns true
. coveo::linq::empty_sequence | The sequence does not have elements. |
coveo::linq::out_of_range | The sequence has no element that satisfy pred . |