fork(11) download
  1. struct MyClass {
  2. template<typename... Tail>
  3. static int count() {
  4. return 0;
  5. }
  6.  
  7. template<char Head, char... Tail>
  8. static int count() {
  9. return 1 + count<Tail...>();
  10. }
  11. };
  12.  
  13. #include <iostream>
  14.  
  15. int main() {
  16. std::cout << MyClass::count<'f','o','o'>();
  17. }
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
3