Boost logo

Boost :

From: Jesse Jones (jejones_at_[hidden])
Date: 2000-11-17 19:30:55

>On Fri, 17 Nov 2000 14:49:26 -0800
>Jesse Jones <jejones_at_[hidden]> wrote:
>> >> This makes it tougher to include the bool
>> >> conversion (how do we know if a functor has a real target or
>> >> not?), which I consider essential.
>> >
>> >The bool conversion can be handled by inclusion of a default
>> >constructor that sets the "impl" pointer to null.
>> Yep (of course a const void* conversion would be better than bool).
>Why is that? A bool conversion says "valid" or "invalid" to call.

No, a bool conversion says that I can be implcitly converted to a bool
which can in turn be used used in an arithmetic expression. So, nonsense
   callback<void> c(Foo);
   int sum = c + 1;
compiles just fine. This is a big enough problem that I never use bool
conversion operators.

>A const void* implies some sort of useful value (which would be...?).

It doesn't neccesarily imply that you can do anything useful with the value
other than compare it to NULL or another void*. However the conversion
rules make const void* much more type safe than bool's.

  -- Jesse

Boost list run by bdawes at, gregod at, cpdaniel at, john at