On Mon, Apr 25, 2016 at 1:06 PM, Jim Blandy <[email protected]> wrote: > On Mon, Apr 25, 2016 at 4:03 AM, Jean-Yves Avenard <[email protected]> > wrote: > >> I don't know how popular this method would be, nor if people would be >> shocked by providing a operator bool() but here it is :) >> >> > Usually, the people most shocked by providing an operator bool() are those > who find the type silently participating in arithmetic expressions...
That's why we have explicit operator bool() in C++11. That only allows the conversion to happen if it's explicitly requested (with 'bool(obj)'), or in certain contexts where a boolean result is unambiguously desired, such as the condition of an if statement. Cheers, Botond _______________________________________________ dev-platform mailing list [email protected] https://lists.mozilla.org/listinfo/dev-platform

