fork download
  1. template<int N>
  2. struct generator
  3. {
  4. static template<class Head, class... Tail>
  5. T prototype(Head _head, Tail _args)
  6. {
  7. return generator<N-1>::prototype(_args);
  8. }
  9. };
  10.  
  11.  
  12. template<>
  13. struct generator<1>
  14. {
  15. static template<class Head>
  16. T prototype(Head _head)
  17. {
  18. return _head;
  19. }
  20. };
  21.  
  22. int main()
  23. {
  24. generator<10>::prototype(1,1,1,1,1, 1,1,1,1,1);
  25. auto a = generator<3>::prototype;
  26.  
  27. return 0;
  28. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:4:9: error: expected unqualified-id before 'template'
  static template<class Head, class... Tail>
         ^
prog.cpp:15:9: error: expected unqualified-id before 'template'
  static template<class Head>
         ^
prog.cpp: In function 'int main()':
prog.cpp:24:2: error: 'prototype' is not a member of 'generator<10>'
  generator<10>::prototype(1,1,1,1,1, 1,1,1,1,1);
  ^
prog.cpp:25:11: error: 'prototype' is not a member of 'generator<3>'
  auto a = generator<3>::prototype;
           ^
stdout
Standard output is empty