fork download
  1. struct MyClass {
  2. template<char ...X>
  3. static int count();
  4. };
  5.  
  6.  
  7. template<>
  8. int MyClass::count<>() {
  9. return 0;
  10. }
  11. template<char Head, char ...Tail>
  12. int MyClass::count<Head, Tail...>() {
  13. return 1 + count<Tail...>();
  14. }
  15.  
  16.  
  17. int main() {
  18. return MyClass::count<'f','o','o'>();
  19. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:12:35: error: function template partial specialization ‘count<Head, Tail ...>’ is not allowed
prog.cpp:12:5: error: prototype for ‘int MyClass::count()’ does not match any in class ‘MyClass’
prog.cpp:3:16: error: candidate is: template<char ...X> static int MyClass::count()
stdout
Standard output is empty