
Hi folks, I know it'd be better to say "overload", but I choose the word carefully because I'm aware of Boost.OverloadedFunction, which is not what I'm talking here (it's complementary, though). What I want is to have std/boost::function support multi-signature itself, instead of relying on some external wrapper which is less efficient. For example: struct A { int operator()() const; int operator()(int val) const; }; function<int(), int(int)> f(A{...}); f can store one instance of A internally, compared to the external approach, in which case each overload holds a standalone instance, plus the control data. I know Boost.Function has its baggage from C++98/03, so changing the interface may not be appropriate, in that case a new library can be considered (Boost.Overload?). A sample C++11 implementation can be found here: https://gist.github.com/jamboree/9489193 What do you think?