fork download
  1. #include <iostream>
  2.  
  3. template<typename T>
  4. struct Comparator
  5. {
  6. bool operator==(const Comparator<T>&)
  7. {
  8. return true;
  9. }
  10. template<typename U>
  11. bool operator==(const Comparator<U>&)
  12. {
  13. return false;
  14. }
  15. };
  16.  
  17. int main() {
  18. Comparator<int> compInt;
  19. Comparator<float> compF;
  20. std::cout << (compInt == compInt) and not (compInt == compF);
  21. return 0;
  22. }
Success #stdin #stdout 0s 4300KB
stdin
Standard input is empty
stdout
1