 #if (__CUDACC_VER_MAJOR__ >11 || (__CUDACC_VER_MAJOR__ == 11 && __CUDACC_VER_MINOR__ >= 2) || HIP_VERSION >= 402)
 THRUST_OPTIONAL_CPP11_CONSTEXPR_LESS
 #endif
-bool less< tuple<size_t, complex<float>> >::operator() (
-    const tuple<size_t, complex<float>>& lhs, const tuple<size_t, complex<float>>& rhs) const {
+bool thrust::less< thrust::tuple<size_t, complex<float>> >::operator() (
+    const thrust::tuple<size_t, complex<float>>& lhs, const thrust::tuple<size_t, complex<float>>& rhs) const {
 
     return _tuple_less<complex<float>>(lhs, rhs);
 }

        cudaStream_t stream_ = (cudaStream_t)stream;
        cupy_allocator alloc(memory);

        device_ptr<size_t> dp_idx_first, dp_idx_last;
        device_ptr<T> dp_data_first, dp_data_last;
        device_ptr<size_t> dp_keys_first, dp_keys_last;

        // Compute the total size of the data array.
        size = shape[0];

public:
    elem_less(const T *data):_data(data) {}
    __device__ __forceinline__ bool operator()(size_t i, size_t j) const {
        return thrust::less<T>()(_data[i], _data[j]);
    }
private:
    const T *_data;
