fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. template<typename T>
  5. struct A
  6. {
  7. T x;
  8. bool operator==(T* y) const
  9. {
  10. return *y == x;
  11. }
  12. bool operator==(const T* y) const
  13. {
  14. return *y == x;
  15. }
  16.  
  17. };
  18.  
  19. int main() {
  20. A<int> a{10};
  21. //A<const int> b{10} // - will not compile
  22. int b = 10;
  23. std::cout << (a == &b);
  24. // your code goes here
  25. return 0;
  26. }
Success #stdin #stdout 0s 16048KB
stdin
Standard input is empty
stdout
1