
Marco Costalba wrote:
On 10/7/07, Miles Bader <miles@gnu.org> wrote:
"Marco Costalba" <mcostalba@gmail.com> writes:
boost::overload<Signatures> f;
// assign functions in any order f.add_overload(foo4);
Given that the entire point is to hold overloads, isn't "add_overload" a bit redundant? Why not just "add"?
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. The right word is "assign". But then what's wrong with operator=? f = &foo4; f = &foo2; f = &foo1; f = &foo5; f = &foo3; It has the right semantics and is very idiomatic. This is how Boost.Function does it. Only in this case, we can have many mappings instead of just one. Regards, -- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net