coveo::linq
Implementation of .NET-like LINQ operators in C++
Functions

Checks if no element in a sequence satisfy a predicate. More...

Functions

template<typename Pred >
auto coveo::linq::none (const Pred &pred) -> detail::none_impl< Pred >
 Checks elements in a sequence against a predicate. More...
 

Detailed Description

The none operator scans a sequence and validates that none of its elements satisfy a given predicate.

This is a terminal operator.

.NET equivalent: n/a

Function Documentation

◆ none()

template<typename Pred >
auto coveo::linq::none ( const Pred &  pred) -> detail::none_impl<Pred>

Scans a sequence and calls a predicate with each element. The predicate must return true if the element satisfies the predicate. The final result will indicate if no elements satisfy the predicate.

Works on empty sequences (returns true in such a case).

Use like this:

const int NUMS = { 42, 23, 66 };
using namespace coveo::linq;
bool no_big = from(NUMS)
| none([](int i) { return i >= 90; });
bool no_odd = from(NUMS)
| none([](int i) { return i % 2 != 0; });
// no_big == true
// no_odd == false
Parameters
predPredicate to satisfy.
Returns
(Once applied) true if no element in sequence satisfy pred.