Skip to main content
Post Made Community Wiki by PleaseStand
Source Link

C++

I'm aware there have been a couple of similarly themed solutions, but here's mine nonetheless:

#include <iostream>

struct Plus {
  int x;
  Plus(int _x):x(_x){}
  Plus operator+(int _x) {
    return Plus(this->x + _x);
  }
  bool operator==(Plus _x) {
    return true;
  }
};

int main() {
  Plus x(0);
  std::cout << bool(x == x + 2); 
}