fork download
  1. #include <iostream>
  2.  
  3. template<typename T>
  4. struct foo
  5. {
  6. void operator ()() const
  7. {
  8. std::cout << "unspecialized\n";
  9. }
  10. };
  11.  
  12. template<>
  13. void foo<long>::operator ()() const
  14. {
  15. std::cout << "specialized for long\n";
  16. }
  17.  
  18. int main()
  19. {
  20. foo<int> f1;
  21. foo<long> f2;
  22. f1();
  23. f2();
  24. }
Success #stdin #stdout 0s 2928KB
stdin
Standard input is empty
stdout
unspecialized
specialized for long