A
Ash
Why is this ok:
bool operator==(Foo* a, Foo& b) { return true; }
and if I have:
Foo* f1; Foo* f2;
then
f1 == *f2
is valid and calls the above function.
but the following (to try to override equality when called using two
raw pointers: f1 == f2):
bool operator==(const Foo* a, const Foo* b) { return true; }
doesn't compile?
(g++ tells me "test2.cpp:9: error: ‘bool operator==(const Foo*, const
Foo*)’ must have an argument of class or enumerated type")
Is it not possible to override the comparison of two pointers (f1 ==
f2) or have I simply not got the exact signature right?
bool operator==(Foo* a, Foo& b) { return true; }
and if I have:
Foo* f1; Foo* f2;
then
f1 == *f2
is valid and calls the above function.
but the following (to try to override equality when called using two
raw pointers: f1 == f2):
bool operator==(const Foo* a, const Foo* b) { return true; }
doesn't compile?
(g++ tells me "test2.cpp:9: error: ‘bool operator==(const Foo*, const
Foo*)’ must have an argument of class or enumerated type")
Is it not possible to override the comparison of two pointers (f1 ==
f2) or have I simply not got the exact signature right?