Thrust
|
◆ binary_search() [7/8]
template<typename DerivedPolicy , typename ForwardIterator , typename InputIterator , typename OutputIterator , typename StrictWeakOrdering >
The algorithm's execution is parallelized as determined by
The following code snippet demonstrates how to use #include <thrust/binary_search.h> #include <thrust/device_vector.h> #include <thrust/functional.h> #include <thrust/execution_policy.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<bool> output(6); input.begin(), input.end(), values.begin(), values.end(), output.begin(), thrust::less<T>()); // output is now [true, false, true, false, true, false] |