thrust

◆ none_of() [2/2]

template<typename InputIterator , typename Predicate >
bool thrust::none_of ( InputIterator  first,
InputIterator  last,
Predicate  pred 
)

none_of determines whether no element in a range satifies a predicate. Specifically, none_of returns true if there is no iterator i in the range [first, last) such that pred(*i) is true, and false otherwise.

Parameters
firstThe beginning of the sequence.
lastThe end of the sequence.
predA predicate used to test range elements.
Returns
true, if no element satisfies the predicate; false, otherwise.
Template Parameters
InputIteratoris a model of Input Iterator,
Predicatemust be a model of Predicate.
#include <thrust/logical.h>
...
bool A[3] = {true, true, false};
thrust::none_of(A, A + 2, thrust::identity<bool>()); // returns false
thrust::none_of(A, A + 3, thrust::identity<bool>()); // returns false
thrust::none_of(A + 2, A + 3, thrust::identity<bool>()); // returns true
// empty range
thrust::none_of(A, A, thrust::identity<bool>()); // returns true
See also
all_of
any_of
transform_reduce