Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <tuple>
- template<int ...>
- struct seq { };
- template<int N, int ...S>
- struct gens : gens<N-1, N-1, S...> { };
- template<int ...S>
- struct gens<0, S...> {
- typedef seq<S...> type;
- };
- template<int ...S, typename ...T>
- void PUSH(seq<S...> const &, std::tuple<T...> const & t)
- {
- using expander = int[]; expander{(std::cout.operator<<(std::get<S>(t)), 0)...};
- std::cout << std::endl;
- }
- template<typename ...T1, typename ...T2>
- void foo(std::tuple<T1...>const& a, std::tuple<T2...>const& b)
- {
- static typename gens<sizeof...(T1)>::type idx1;
- static typename gens<sizeof...(T2)>::type idx2;
- PUSH(idx1, (a));
- PUSH(idx2, (b));
- }
- int main() {
- auto t = std::make_tuple(1,2,3);
- foo(t, std::make_tuple(1,2,5,6,8));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement