fork download
  1. #include <iostream>
  2.  
  3. template< class U, class X, class T >
  4. class Klasa
  5. {
  6. public:
  7. template< typename Z >
  8. void Method()
  9. {
  10. }
  11. };
  12.  
  13. template< class U >
  14. class Klasa< U, int, U >
  15. {
  16. public:
  17. template< typename Z >
  18. void Method()
  19. {
  20. typedef typename std::enable_if< !std::is_same< int, Z >::value, Z >::type whatever;
  21.  
  22. std::cout << "Method< Z >" << std::endl;
  23. }
  24. void Method()
  25. {
  26. std::cout << "Method< int >" << std::endl;
  27. }
  28. };
  29.  
  30. int main()
  31. {
  32. Klasa< float, int, float > lK;
  33.  
  34. lK.Method< float >();
  35. lK.Method< double >();
  36. lK.Method();
  37.  
  38. return( 0 );
  39. }
Success #stdin #stdout 0s 2828KB
stdin
Standard input is empty
stdout
Method< Z >
Method< Z >
Method< int >