Do I have to provide two different versions of operator == overload so that it works irregardless of the LHS & RHS variant of expressions. Eg.
Class A {
...
bool operator==(int const& L, A const& R);
bool operator==(A const& L, int const& R);
...
};
For usage like -
A a;
int x = 8;
if( a == 5 || x == a){
...
}
And why is there a need to do so? Isn't L == R == R == L?
Aucun commentaire:
Enregistrer un commentaire