thrust::any_of
Defined in thrust/logical.h
-
template<typename InputIterator, typename Predicate>
bool thrust::any_of(InputIterator first, InputIterator last, Predicate pred) any_of
determines whether any element in a range satifies a predicate. Specifically,any_of
returnstrue
ifpred(*i)
istrue
for any iteratori
in the range[first, last)
andfalse
otherwise.#include <thrust/logical.h> #include <thrust/functional.h> ... bool A[3] = {true, true, false}; thrust::any_of(A, A + 2, thrust::identity<bool>()); // returns true thrust::any_of(A, A + 3, thrust::identity<bool>()); // returns true thrust::any_of(A + 2, A + 3, thrust::identity<bool>()); // returns false // empty range thrust::any_of(A, A, thrust::identity<bool>()); // returns false
See also
all_of
See also
none_of
See also
transform_reduce
- Parameters
first – The beginning of the sequence.
last – The end of the sequence.
pred – A predicate used to test range elements.
- Template Parameters
InputIterator – is a model of Input Iterator,
Predicate – must be a model of Predicate.
- Returns
true
, if any element satisfies the predicate;false
, otherwise.