Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
implements variadic overload of make_zip_iterator #663
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewcorrigan committed Oct 12, 2020
1 parent 6ff6c6d commit 5c5551c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
14 changes: 11 additions & 3 deletions thrust/iterator/detail/zip_iterator.inl
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,19 @@ template<typename IteratorTuple>
} // end zip_iterator::distance_to()


template<typename IteratorTuple>
template<typename... Iterators>
__host__ __device__
zip_iterator<thrust::tuple<Iterators...>> make_zip_iterator(thrust::tuple<Iterators...> t)
{
return zip_iterator<thrust::tuple<Iterators...>>(t);
} // end make_zip_iterator()


template<typename... Iterators>
__host__ __device__
zip_iterator<IteratorTuple> make_zip_iterator(IteratorTuple t)
zip_iterator<thrust::tuple<Iterators...>> make_zip_iterator(Iterators... its)
{
return zip_iterator<IteratorTuple>(t);
return make_zip_iterator(thrust::make_tuple(its...));
} // end make_zip_iterator()


Expand Down
18 changes: 16 additions & 2 deletions thrust/iterator/zip_iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,23 @@ template <typename IteratorTuple>
*
* \see zip_iterator
*/
template<typename IteratorTuple>
template<typename... Iterators>
inline __host__ __device__
zip_iterator<IteratorTuple> make_zip_iterator(IteratorTuple t);
zip_iterator<thrust::tuple<Iterators...>> make_zip_iterator(thrust::tuple<Iterators...> t);


/*! \p make_zip_iterator creates a \p zip_iterator from
* iterators.
*
* \param its The iterators to copy.
* \return A newly created \p zip_iterator which zips the iterators.
*
* \see zip_iterator
*/
template<typename... Iterators>
inline __host__ __device__
zip_iterator<thrust::tuple<Iterators...>> make_zip_iterator(Iterators... its);


/*! \} // end fancyiterators
*/
Expand Down

0 comments on commit 5c5551c

Please sign in to comment.