fork download
  1. #include <iostream>
  2. #include <boost/strong_typedef.hpp>
  3.  
  4. BOOST_STRONG_TYPEDEF(int, foo);
  5.  
  6. template <typename T>
  7. void bar(T param)
  8. {
  9. std::cout << "Inside unspecialized function template." << std::endl;
  10. }
  11.  
  12. template <>
  13. void bar(foo param)
  14. {
  15. std::cout << "Inside specialization." << std::endl;
  16. }
  17.  
  18. int main()
  19. {
  20. bar(123);
  21. foo param(123);
  22. bar(param);
  23. return 0;
  24. }
Success #stdin #stdout 0.01s 2724KB
stdin
Standard input is empty
stdout
Inside unspecialized function template.
Inside specialization.