Boost logo

Boost :

From: Joel de Guzman (joel_at_[hidden])
Date: 2007-10-08 03:39:40


Johan Nilsson wrote:
> Joel de Guzman wrote:
>> Marco Costalba wrote:
>
> [snip]
>
>>> Yes I agree, also because 'overload' is already the name of the
>>> struct so perhaps add_function() would be better but also functors
>>> can be added so....perhaps just add() is the best, util now ;-)
>> "add" looks good, until you "add" something outside the overload set.
>> You can't.
>
> That's why it's good.
>
>> The right word is "assign".

Why is it good?

> I beg to differ.
>
>> But then what's wrong with
>> operator=?
>>
>> f = &foo4;
>> f = &foo2;
>> f = &foo1;
>> f = &foo5;
>> f = &foo3;
>>
>
> At the end of this example one would expect f to only have one overload;
> foo3.
>
> IMHO, "add" is good. If one really needs to use operators for adding
> overloads, why not use "+="?

Oh my, getting to be a bicycle shed ;-) Ok, I don't have a strong
opinion either way :-) To be honest, I'm not quite sure with all
these if they cannot be made to handle polymorphic functions. It
kinda defeats the purpose if we need to have a different syntax
for polymorphic function objects and function pointers/mem function
pointers. So, in the end, an explicit form of "set" is still better,
IMO.

Regards,

-- 
Joel de Guzman
http://www.boost-consulting.com
http://spirit.sf.net

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