Boost logo

Boost :

From: Joel de Guzman (joel_at_[hidden])
Date: 2007-10-06 19:18:50


Marco Costalba wrote:

> The important update of this version of overload.hpp is that indices
> are avoided and the order of registering the overload functions can be
> random, i.e. has not to follow the order of declaration of the
> signatures that the overload class supports.

There's a big problem with that: you can't (there's no way) to
deduce the signatures of polymorphic function objects. Example:

     struct square {
         template <typename T> T operator()(T x) const;
     };

> Choosing add_overload(), operator<<() or something else is just a
> taste matter IMHO.
>
> Using operator<<() would be nice, but if this can create confusion it
> can be changed to something else 'Surely better'.

I don't quite like the operator in this case, FWIW. As Dave (A)
always says, use of such operators should be idiomatic. In this
case, it is not.

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