thrust::find
Defined in thrust/find.h
- 
template<typename DerivedPolicy, typename InputIterator, typename T>
 InputIterator thrust::find(const thrust::detail::execution_policy_base<DerivedPolicy> &exec, InputIterator first, InputIterator last, const T &value)
- findreturns the first iterator- iin the range- [first, last)such that- *i == valueor- lastif no such iterator exists.- The algorithm’s execution is parallelized as determined by - exec.- #include <thrust/find.h> #include <thrust/device_vector.h> #include <thrust/execution_policy.h> ... 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(thrust::device, input.begin(), input.end(), 3); // returns input.first() + 2 iter = thrust::find(thrust::device, input.begin(), input.end(), 5); // returns input.first() + 1 iter = thrust::find(thrust::device, input.begin(), input.end(), 9); // returns input.end() - See also - find_if - See also - mismatch - Parameters
- exec – The execution policy to use for parallelization. 
- first – Beginning of the sequence to search. 
- last – End of the sequence to search. 
- value – The value to find. 
 
- Template Parameters
- DerivedPolicy – The name of the derived execution policy. 
- InputIterator – is a model of Input Iterator and - InputIterator's- value_typeis equality comparable to type- T.
- T – is a model of EqualityComparable. 
 
- Returns
- The first iterator - isuch that- *i == valueor- last.