Possible Duplicate:
Is it possible to figure out the parameter type and return type of a lambda?
I'd like to make a function that accepts an integer and an arbitrary function (with arbitrary return type and arguments), to be called like so:
server.bind(tag, [&](std::string greeting) { return greeting + " earth."; });
Any ideas on how to set up the templates to get the lambda's return type and the types of the lambda's arguments deducted?
The following code is as close as I could get, but it fails template argument deduction with the above code:
template <typename Return, typename... Args>
void service::bind(uint16_t tag,
std::function<Return (Args...)> function)
{
...
}