Skip to content

Commit 03df551

Browse files
committed
Fix zip_iterator::distance_to to work with non-RA iters.
1 parent 69af7e0 commit 03df551

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

thrust/thrust/iterator/zip_iterator.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#include <thrust/type_traits/integer_sequence.h>
4747

4848
#include <cuda/std/__iterator/advance.h>
49+
#include <cuda/std/__iterator/distance.h>
4950
#include <cuda/std/__type_traits/conditional.h>
5051
#include <cuda/std/__type_traits/enable_if.h>
5152
#include <cuda/std/__type_traits/is_constructible.h>
@@ -302,7 +303,7 @@ class _CCCL_DECLSPEC_EMPTY_BASES zip_iterator : public detail::make_zip_iterator
302303
inline _CCCL_HOST_DEVICE typename super_t::difference_type
303304
distance_to(const zip_iterator<OtherIteratorTuple>& other) const
304305
{
305-
return get<0>(other.get_iterator_tuple()) - get<0>(get_iterator_tuple());
306+
return ::cuda::std::distance(get<0>(get_iterator_tuple()), get<0>(other.get_iterator_tuple()));
306307
}
307308

308309
// The iterator tuple.

0 commit comments

Comments
 (0)