|
coveo::linq
Implementation of .NET-like LINQ operators in C++
|
Returns last element in a sequence. More...
Functions | |
| template<typename = void> | |
| auto | coveo::linq::last () -> detail::last_impl_0<> |
| Returns last element in sequence. More... | |
| template<typename Pred > | |
| auto | coveo::linq::last (const Pred &pred) -> detail::last_impl_1< Pred > |
| Returns last element in sequence that satisfy predicate. More... | |
The last 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, an exception is thrown.
This is a terminal operator.
.NET equivalent: Last
| auto coveo::linq::last | ( | ) | -> detail::last_impl_0<> |
Returns the last 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::last | ( | const Pred & | pred | ) | -> detail::last_impl_1<Pred> |
Returns the last 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. |
1.8.15