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