fork download
  1. #include <tuple>
  2. #include <iostream>
  3.  
  4. struct A { using data_type = int; };
  5. struct B { using data_type = char; };
  6.  
  7. template < typename... Ts >
  8. using cvt_2_data = std::tuple< Ts::data... >;
  9.  
  10. void main()
  11. {
  12. using my_typelist = std::tuple<A, B>;
  13. cvt_2_data<my_typelist> data;
  14. std::cout
  15. << std::get<A::data_type>(data) << " "
  16. << std::get<B::data_type>(data) << std::endl;
  17. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:8:32: error: template argument for template type parameter must be a type
using cvt_2_data = std::tuple< Ts::data... >;
                               ^~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/tuple:555:24: note: template parameter is declared here
  template<typename... _Elements>
                       ^
prog.cpp:10:1: error: 'main' must return 'int'
void main()
^~~~
int
prog.cpp:13:2: error: use of undeclared identifier 'cvt_2_data'
        cvt_2_data<my_typelist> data;
        ^
prog.cpp:13:13: error: unexpected type name 'my_typelist': expected expression
        cvt_2_data<my_typelist> data;
                   ^
prog.cpp:13:26: error: use of undeclared identifier 'data'
        cvt_2_data<my_typelist> data;
                                ^
prog.cpp:15:29: error: use of undeclared identifier 'data'
                << std::get<A::data_type>(data) << " "
                                          ^
prog.cpp:16:29: error: use of undeclared identifier 'data'
                << std::get<B::data_type>(data) << std::endl;
                                          ^
7 errors generated.
stdout
Standard output is empty