Thrust
|
◆ lower_bound() [6/8]
template<class ForwardIterator , class InputIterator , class OutputIterator >
The following code snippet demonstrates how to use #include <thrust/binary_search.h> #include <thrust/device_vector.h> ... thrust::device_vector<int> input(5); input[0] = 0; input[1] = 2; input[2] = 5; input[3] = 7; input[4] = 8; thrust::device_vector<int> values(6); values[0] = 0; values[1] = 1; values[2] = 2; values[3] = 3; values[4] = 8; values[5] = 9; thrust::device_vector<unsigned int> output(6); thrust::lower_bound(input.begin(), input.end(), values.begin(), values.end(), output.begin()); // output is now [0, 1, 1, 2, 4, 5] |