fork(1) download
  1. #include <iostream>
  2.  
  3. template < typename T > struct ff ;
  4.  
  5. template <typename T> void f( T t ) { ff<T>::f(t) ; }
  6.  
  7. template < typename T > struct ff
  8. { static void f(T) { std::cout << "general\n" ; } } ;
  9.  
  10. template < typename T > struct ff<T*>
  11. { static void f(T*) { std::cout << "partial for pointers\n" ; } } ;
  12.  
  13. template <> struct ff<int>
  14. { static void f(int) { std::cout << "complete for int\n" ; } } ;
  15.  
  16. int main()
  17. {
  18. f('a') ; // general
  19. int a = 8 ;
  20. f(a) ; // complete for int
  21. f(&a) ; // partial for pointers
  22. }
  23.  
Success #stdin #stdout 0s 2852KB
stdin
Standard input is empty
stdout
general
complete for int
partial for pointers