Boost logo

Boost :

From: Jesse Jones (jesjones_at_[hidden])
Date: 2000-11-18 17:11:10

>--- In boost_at_[hidden], Jesse Jones <jejones_at_a...> wrote:
>> >On Fri, 17 Nov 2000 15:31:35 -0800
>> >Jesse Jones <jejones_at_a...> wrote:
>> But we know that we want to have some sort of empty test. If we do
>> with a bool or const void* conversion operator users will be able to
>> compare any two callback objects, but in all probability this will
>> false unless you're dealing with the exact same callback on the
>left and
>> right.
>Actually, with the conversions in place comparisons will usually
>return true. cb1 converts to a bool (likely true) and cb2 converts
>to a bool (likely true) and hence comparison likely returns true
>regardless if the callbacks are exactly the same.

For bool conversions any two non-empty callback objects will compare
equal. For const void* conversions they'll compare not equal.

>(Actually, I'm
>quite tired while writing this and I'm not sure that the implicit
>conversions should occur in this case. I'm fairly sure that if the
>callbacks are of the same type the conversion will not occur.)


>> We can document that comparisons don't work as expected, but it
>> seems better to arrange for a compile error if the user does
>> wrong.
>That's simple. You eliminate the comparison operations from the
>public interface (explicitly make them private). It's then a
>compiler error to try and use them, which is the best idea
>considering we can't make them return useful information.

Yeah, but since they're not one of the magic methods synthesized by the
compiler I don't see why we need to declare them at all.

  -- Jesse

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