fork download
  1. template <template <class...> class Type_container, class... T1s, class... T2s>
  2. constexpr auto concat(Type_container<T1s...>, Type_container<T2s...>) {
  3. return Type_container<T1s..., T2s...>{};
  4. }
  5. template <class Seq1, class Seq2, class... Seqs>
  6. constexpr auto concat(Seq1 s1, Seq2 s2, Seqs... s) {
  7. return concat(s1, concat(s2, s...));
  8. }
  9.  
  10. template <typename...>
  11. struct Type_list{};
  12.  
  13. using list1 = Type_list<int>;
  14. using list2 = Type_list<char>;
  15. using list3 = Type_list<bool>;
  16.  
  17. #include <cstdio>
  18.  
  19. template <typename T>
  20. void print_type(T) {
  21. puts(__PRETTY_FUNCTION__);
  22. }
  23.  
  24. int main(){
  25. print_type(concat(list1{}, list2{}, list3{}));
  26. }
  27.  
Success #stdin #stdout 0s 4544KB
stdin
Standard input is empty
stdout
void print_type(T) [with T = Type_list<int, char, bool>]