Skip to content

Commit

Permalink
implements NVIDIA#663
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewcorrigan committed Jul 14, 2015
1 parent 1458c8e commit 1189d05
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
17 changes: 16 additions & 1 deletion thrust/iterator/detail/zip_iterator.inl
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,29 @@ template<typename IteratorTuple>
return get<0>(other.get_iterator_tuple()) - get<0>(get_iterator_tuple());
} // end zip_iterator::distance_to()

#ifdef THRUST_VARIADIC_TUPLE
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<thrust::tuple<Iterators...>> make_zip_iterator(Iterators... its)
{
return make_zip_iterator(thrust::make_tuple(its...));
} // end make_zip_iterator()
#else
template<typename IteratorTuple>
__host__ __device__
zip_iterator<IteratorTuple> make_zip_iterator(IteratorTuple t)
{
return zip_iterator<IteratorTuple>(t);
} // end make_zip_iterator()

#endif

} // end thrust

20 changes: 20 additions & 0 deletions thrust/iterator/zip_iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,29 @@ template <typename IteratorTuple>
*
* \see zip_iterator
*/
#ifdef THRUST_VARIADIC_TUPLE
template<typename... Iterators>
inline __host__ __device__
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);
#else
template<typename IteratorTuple>
inline __host__ __device__
zip_iterator<IteratorTuple> make_zip_iterator(IteratorTuple t);
#endif


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

0 comments on commit 1189d05

Please sign in to comment.