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

Variadic make zip iterator #1312

Merged
merged 1 commit into from
Oct 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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