Boost logo

Boost :

From: Marco (mrcekets_at_[hidden])
Date: 2007-11-02 18:44:07


On Fri, 02 Nov 2007 09:47:14 +0100, gchen <chengang31_at_[hidden]> wrote:

> Marco wrote:
>> A new release of boost overload is out.
>>
> [...]
>>
>> You can read more about boost overload here:
>> http://docs.google.com/Doc?id=dhd386mp_16gxsfxn
>> The documentation was kindly written down by Dean Michael Berris.
>>
>
> Looks interesting. Just one naive question...
>
> If a overload variable can be set any function, why bother giving it a
> signature when declaring it? Why not just:
>
> overload<> f;
> // or simply
> boost::overload f;
>
> f.set(&int_sum); // here automatic signature
> f.set(&float_inc); // deduction occurs
>
> f.set(&any_function);
>

Well the reason is that we can deduce the signature
but then we have to store the passed argument in a
function pointer of the correct type ( == with the
correct signature ), otherwise we can't use
it to forwarding a call to the function it points to.
The issue is that the deduction occurs at run time,
while we need to know the correct type at compile time.

Marco

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

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