In this example a function is passed to an implicitly instantiated function template.
// Function that will be passed as argument
int foo() { return 0; }
//
The closest you can get is probably this:
struct sfoo
{
template
void operator() (args&&... a)
{
foo(std::forward(a)...);
}
};
and pass sfoo
(or sfoo()
) instead of foo
around.
That is, create a function object type that encapsulates the entire overload set in the templatized operator()
.
Then instead of overload resolution over a template argument, which does not exist, you get a template instantiation over the same argument, which is OK.