I'm having troubles implementing this in legacy C++, but I'm pretty sure it can be done. Say I have a higher order function that needs two versions, one for unary callables (function objects, functions, member functions)
template <class F>
void ho_fun(F argFun) {
int arg1;
argFun(arg1);
}
and one for binary:
template <class F>
void ho_fun(F argFun) {
int arg1, arg2;
argFun(arg1, arg2);
}
I'm looking for a complete solution in terms of "callable type" (otherwise I'd obviously use arity from function traits for this) i.e. support for functions and function objects.
I'm translating this lovely post to C++03 (remove ...
and using
typedefs) but it doesn't seem to work.
PS. I'm not solving the particular problem listed above, that's just the sscce. Also I mention C++03 because I'm working on legacy code for this project and a modern solution is of no use to me. By all means feel free to post a modern one but please consider helping me as well.