Boost logo

Boost :

From: Jesse Jones (jesjones_at_[hidden])
Date: 2001-05-07 05:17:59


At 9:52 AM +0200 5/7/01, Geurt Vos wrote:
> > >
>> > Hmm, I would say if I can assign a function pointer, it is
>> > only natural that I can also assign 0. Additionally, since
>> > 'if (f)', or better 'if (f !=/== 0)' is possible, it again
>> > makes 'f = 0' an obvious possibility.
>>
>> I completely disagree with this :)
>> The conversion to bool (const void*, const undeleteable*, whatever)
>should
>> be though of as: 'if f evaluates true, then f has some target it will
>execute
>> if you invoke f's function call operator' not 'f can be implicitly
>converted
>> to its function pointer'. boost::function deals with function objects, not
>> function pointers; function objects are copy constructible and invocable,
>and
>> function pointers are a refinement of function objects that are also
>> assignable and equality comparable. We need to look at the core concept
>that
>> boost::function handles - the function object - and not inject syntax for
>it
>> based on the properties of specific refinements of that concept (Jesse -
>same
> > argument goes for operator==).

The problem with this is that if boost::function doesn't have
operator== users are hosed. Their only recourse is to code some sort
of work around or use a different callback class with a huge amount
of overlap with boost::function.

   -- Jesse


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk