Boost logo

Boost :

Subject: [boost] [functional] adding overload
From: Lorenzo Caminiti (lorcaminiti_at_[hidden])
Date: 2012-01-15 16:53:24


Hello all,

During Boost.Local review, it was proposed to move the overload
template out of Local and in Boost.Functional. What would the best
name for it?

1) boost::overload_function (my preference)
2) boost::overloaded_function
3) boost::function_overload
4) boost::functional::overload (Boost.Functional seems to use boost::
directly and not boost::functional-- to mimic C++11 <functional>).

For example:

void print_text(char const* text) { std::cout << text << std::endl; }
void print_add(int x, int y = 10) { std::cout << (x + y) << std::endl; }
boost::function<void (int, int)> f = print_add;

boost::overload_function<
     void (char const*)
   , void (int, int)
   , void (int)
> print(print_text, f, print_add);

print("abc"); // abc
print(1, 2); // 3
print(1); // 11

Docs:
https://svn.boost.org/svn/boost/sandbox/local/libs/local/doc/html/boost/local/function/overload.html

Thanks.
--Lorenzo


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