Thrust
|
◆ equal_range() [1/4]
template<typename DerivedPolicy , typename ForwardIterator , typename LessThanComparable >
This version of 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/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::equal_range(thrust::device, input.begin(), input.end(), 0); // returns [input.begin(), input.begin() + 1) thrust::equal_range(thrust::device, input.begin(), input.end(), 1); // returns [input.begin() + 1, input.begin() + 1) thrust::equal_range(thrust::device, input.begin(), input.end(), 2); // returns [input.begin() + 1, input.begin() + 2) thrust::equal_range(thrust::device, input.begin(), input.end(), 3); // returns [input.begin() + 2, input.begin() + 2) thrust::equal_range(thrust::device, input.begin(), input.end(), 8); // returns [input.begin() + 4, input.end) thrust::equal_range(thrust::device, input.begin(), input.end(), 9); // returns [input.end(), input.end) |