◆ find_if_not() [1/2]

template<typename DerivedPolicy , typename InputIterator , typename Predicate >
__host__ __device__ InputIterator thrust::find_if_not ( const thrust::detail::execution_policy_base< DerivedPolicy > &  exec,
InputIterator  first,
InputIterator  last,
Predicate  pred 

find_if_not returns the first iterator i in the range [first, last) such that pred(*i) is false or last if no such iterator exists.

The algorithm's execution is parallelized as determined by exec.

execThe execution policy to use for parallelization.
firstBeginning of the sequence to search.
lastEnd of the sequence to search.
predA predicate used to test range elements.
The first iterator i such that pred(*i) is false, or last.
Template Parameters
DerivedPolicyThe name of the derived execution policy.
InputIteratoris a model of Input Iterator.
Predicateis a model of Predicate.
#include <thrust/find.h>
struct greater_than_four
__host__ __device__
bool operator()(int x)
return x > 4;
struct greater_than_ten
__host__ __device__
bool operator()(int x)
return x > 10;
thrust::device_vector<int> input(4);
input[0] = 0;
input[1] = 5;
input[2] = 3;
input[3] = 7;
iter = thrust::find_if_not(thrust::device, input.begin(), input.end(), greater_than_four()); // returns input.first()
iter = thrust::find_if_not(thrust::device, input.begin(), input.end(), greater_than_ten()); // returns input.first()
See also