Template Function thrust::find(InputIterator, InputIterator, const T&)¶
Function Documentation¶
-
template<typename
InputIterator, typenameT>
InputIteratorthrust::find(InputIterator first, InputIterator last, const T &value) findreturns the first iteratoriin the range[first, last)such that*i == valueorlastif no such iterator exists.#include <thrust/find.h> #include <thrust/device_vector.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(input.begin(), input.end(), 3); // returns input.first() + 2 iter = thrust::find(input.begin(), input.end(), 5); // returns input.first() + 1 iter = thrust::find(input.begin(), input.end(), 9); // returns input.end()
- Return
The first iterator
isuch that*i == valueorlast.- Parameters
first: Beginning of the sequence to search.last: End of the sequence to search.value: The value to find.
- Template Parameters
InputIterator: is a model of Input Iterator andInputIterator'svalue_typeis equality comparable to typeT.T: is a model of EqualityComparable.
- See
find_if
- See
mismatch