In this case
void f(int *);
void f(const int *);
...
int i;
f(&i);
the situation is pretty clear - the f (int *) call seems correct.
However, if I have this (this was done by mistake (*)):
class aa
{
public:
operator bool() const;
operator char *();
};
void func(bool);
aa a;
func(a);
Operatorchar * () is called. I can’t understand why such a solution would be better than going to the bool () operator. Any ideas?
(*) If a constant is added to the second statement, the code works as expected, of course.
source
share