
On 28.05.2011, at 22:31, Matt Calabrese wrote:
On Sat, May 28, 2011 at 3:23 PM, Jeffrey Lee Hellrung, Jr. < jeffrey.hellrung@gmail.com> wrote:
Here's a trial attempt at an implementation of the macro (warning: not tested):
I haven't looked at the implementation in depth, but if I recall correctly, C++0x explicit conversions to bool are not quite the same as a safe-bool conversion (explicit conversions still generally require explicit casts, correct me if I'm wrong).
True. You can only omit the case in "contextual conversion" situations, which are: - Conditions of if, while, do..while and for (maybe switch? not sure). - Arguments to &&, || and !. - First argument to ?:. So these two code examples that a 03 user might write would fail: convertible_to_bool obj; bool b = obj; // must write bool b(obj); void fn(bool); fn(obj); // must cast Sebastian