fork(1) download
  1. #include <functional>
  2. #include <type_traits>
  3.  
  4. constexpr int ParametersCountLimit = 100;
  5.  
  6. template <typename Head, typename ... Tail>
  7. struct helper
  8. {
  9. using guard = typename std::enable_if<sizeof...(Tail) < ParametersCountLimit>::type;
  10. using next = helper<Head, Tail..., Head>;
  11. using fn = Head(Head, Tail...);
  12. };
  13.  
  14. template <typename T, int N>
  15. struct generator
  16. {
  17. using helper_type = typename generator<T, N-1>::helper_type::next;
  18. using type = typename helper_type::fn;
  19. };
  20.  
  21. template <typename T>
  22. struct generator<T,2>
  23. {
  24. using helper_type = helper<T, T>;
  25. using type = typename helper_type::fn;
  26. };
  27.  
  28. template <class T>
  29. class TD;
  30.  
  31. int main()
  32. {
  33. TD< generator<int,99>::type > d;
  34. return 0;
  35. }
  36.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:33:32: error: aggregate 'TD<int(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int)> d' has incomplete type and cannot be defined
  TD< generator<int,99>::type > d;
                                ^
stdout
Standard output is empty