fork download
  1. #include <iostream>
  2.  
  3. class A
  4. {
  5. int a;
  6. public:
  7. A() : a(0) {}
  8. int get() { return a; }
  9. template<typename T>
  10. void function() {}
  11. };
  12.  
  13. struct dummy {};
  14.  
  15. template<>
  16. void A::function<dummy>()
  17. {
  18. a = 500;
  19. }
  20.  
  21. int main()
  22. {
  23. A a;
  24. std::cout << a.get() << std::endl;
  25. a.function<dummy>();
  26. std::cout << a.get() << std::endl;
  27. }
Success #stdin #stdout 0s 2852KB
stdin
Standard input is empty
stdout
0
500