If I create conversion operators for a class, such as:
operator const float*() const { return FData; }
Then provide a bool or BOOL (int) operator:
operator bool() const { return FData && *FData != 0; }
Then when using the class in a condition such as "if( instance )", the bool operator seems to be the one favored without any compiler complaints. However, if I attempt to use several of the class in the same condition, such as "if( instance_a && instance_b ), I get ambiguous complaints involving the built in && operator. It can't seem to choose between the float* and bool type.
Why is it that two together seem to make the operation more complex? And is there any way I can fix the problem without removing one of the conversion operators?
Thanks for any help