1 // The Art of C++ / Sequences
2 // Copyright (c) 2015 Daniel Frey
3 
4 #ifndef TAOCPP_SEQUENCES_INCLUDE_ZIP_HPP
5 #define TAOCPP_SEQUENCES_INCLUDE_ZIP_HPP
6 
7 #include <type_traits>
8 
9 #include "integer_sequence.hpp"
10 
11 namespace tao
12 {
13   namespace seq
14   {
15     template< template< typename U, U, U > class, typename, typename >
16     struct zip;
17 
18     template< template< typename U, U, U > class OP, typename TA, TA... As, typename TB, TB... Bs >
19     struct zip< OP, integer_sequence< TA, As... >, integer_sequence< TB, Bs... > >
20     {
21       using CT = typename std::common_type< TA, TB >::type;
22       using type = integer_sequence< CT, OP< CT, As, Bs >::value... >;
23     };
24 
25     template< template< typename U, U, U > class OP, typename A, typename B >
26     using zip_t = typename zip< OP, A, B >::type;
27   }
28 }
29 
30 #endif // TAOCPP_SEQUENCES_INCLUDE_ZIP_HPP
31