Template Function thrust::find_if_not(InputIterator, InputIterator, Predicate)¶
Function Documentation¶
-
template<typename
InputIterator, typenamePredicate>
InputIteratorthrust::find_if_not(InputIterator first, InputIterator last, Predicate pred) find_if_notreturns the first iteratoriin the range[first, last)such thatpred(*i)isfalseorlastif no such iterator exists.#include <thrust/find.h> #include <thrust/device_vector.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; thrust::device_vector<int>::iterator iter; iter = thrust::find_if_not(input.begin(), input.end(), greater_than_four()); // returns input.first() iter = thrust::find_if_not(input.begin(), input.end(), greater_than_ten()); // returns input.first()
- Return
The first iterator
isuch thatpred(*i)isfalse, orlast.- Parameters
first: Beginning of the sequence to search.last: End of the sequence to search.pred: A predicate used to test range elements.
- Template Parameters
InputIterator: is a model of Input Iterator.Predicate: is a model of Predicate.
- See
find
- See
find_if
- See
mismatch