Thrust
|
◆ unique_by_key() [4/4]
template<typename ForwardIterator1 , typename ForwardIterator2 , typename BinaryPredicate >
This version of
The following code snippet demonstrates how to use #include <thrust/unique.h> ... const int N = 7; int A[N] = {1, 3, 3, 3, 2, 2, 1}; // keys int B[N] = {9, 8, 7, 6, 5, 4, 3}; // values thrust::pair<int*,int*> new_end; thrust::equal_to<int> binary_pred; new_end = thrust::unique_by_key(keys, keys + N, values, binary_pred); // The first four keys in A are now {1, 3, 2, 1} and new_end.first - A is 4. // The first four values in B are now {9, 8, 5, 3} and new_end.second - B is 4.
|