2

I would like to overload the operator~ but not as an unary operator but as an binary operator so i can do thinks like a~b. is there a way doing this in c++?

Exagon
  • 4,798
  • 6
  • 25
  • 53

2 Answers2

12

There is no way of doing this in C++. Period.

Ed Heal
  • 59,252
  • 17
  • 87
  • 127
2

You could change the behavior by operator overloading, but you couldn't change the number of operands.

It is not possible to change the precedence, grouping, or number of operands of operators.

songyuanyao
  • 169,198
  • 16
  • 310
  • 405