fork download
  1. #include <iostream>
  2. #include <utility>
  3.  
  4. using namespace std;
  5. template<typename... list> struct typeList;
  6.  
  7.  
  8. template<typename, typename> struct zipper;
  9. template<typename...L, typename...R> struct zipper<typeList<L...>, typeList<R...>> : std::tuple<std::pair<L,R>...>
  10. {
  11. typedef std::tuple<std::pair<L,R>...> tuplez;
  12. static_assert(sizeof...(L)==sizeof...(R), "Mismatch number of Args...");
  13.  
  14. static void print()
  15. {
  16. std::cout<<"The types are: "<<std::endl;
  17. for(int i=0; i<std::tuple_size<tuplez>::value ; ++i)
  18. std::cout<< "first : "<< typeid(std::tuple_element<i, tuplez>::type::first_type).name()<<
  19. "second : "<<typeid(std::tuple_element<i, tuplez>::type::second_type).name() <<std::endl;
  20. }
  21. };
  22.  
  23. int main()
  24. {
  25. zipper<typeList<int,double>, typeList<char,int>>::print();
  26. return 0;
  27. }
  28.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:9:96: error: expected template-name before '<' token
prog.cpp:9:96: error: expected '{' before '<' token
prog.cpp:9:96: error: expected unqualified-id before '<' token
prog.cpp: In function 'int main()':
prog.cpp:25:5: error: incomplete type 'zipper<typeList<int, double>, typeList<char, int> >' used in nested name specifier
stdout
Standard output is empty