fork(2) download
  1. #include <type_traits>
  2. #include <iostream>
  3.  
  4. template<typename T>
  5. struct foo
  6. {
  7.  
  8. };
  9.  
  10.  
  11. template<typename T>
  12. bool operator==( const foo<T>& lhs , const foo<T>& rhs )
  13. {
  14. return true;
  15. }
  16.  
  17. template<typename T , typename U>
  18. bool operator==( const foo<T>& lhs , const foo<U>& rhs )
  19. {
  20. return false;
  21. }
  22.  
  23.  
  24. int main()
  25. {
  26. std::cout << std::boolalpha << ( foo<int>() == foo<int>() ) << std::endl;
  27. std::cout << std::boolalpha << ( foo<int>() == foo<char>() ) << std::endl;
  28. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
true
false