#include <functional>
using namespace std;
template<typename T>
struct memfun_type
{
using type = void;
};
template<typename Ret, typename Class, typename... Args>
struct memfun_type<Ret(Class::*)(Args...) const>
{
using type = std::function<Ret(Args...)>;
};
template<typename F>
typename memfun_type<decltype(&F::operator())>::type
FFL(F const &func)
{ // Function from lambda !
return func;
}
template <typename... Args> void Callback(std::function<void(Args...)> f){
// store f and call later
}
int main()
{
Callback(FFL([](int a, float b){
// do something
}));
return 0;
}
I2luY2x1ZGUgPGZ1bmN0aW9uYWw+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdGVtcGxhdGU8dHlwZW5hbWUgVD4Kc3RydWN0IG1lbWZ1bl90eXBlCnsKICAgIHVzaW5nIHR5cGUgPSB2b2lkOwp9OwoKdGVtcGxhdGU8dHlwZW5hbWUgUmV0LCB0eXBlbmFtZSBDbGFzcywgdHlwZW5hbWUuLi4gQXJncz4Kc3RydWN0IG1lbWZ1bl90eXBlPFJldChDbGFzczo6KikoQXJncy4uLikgY29uc3Q+CnsKICAgIHVzaW5nIHR5cGUgPSBzdGQ6OmZ1bmN0aW9uPFJldChBcmdzLi4uKT47Cn07Cgp0ZW1wbGF0ZTx0eXBlbmFtZSBGPgp0eXBlbmFtZSBtZW1mdW5fdHlwZTxkZWNsdHlwZSgmRjo6b3BlcmF0b3IoKSk+Ojp0eXBlCkZGTChGIGNvbnN0ICZmdW5jKQp7IC8vIEZ1bmN0aW9uIGZyb20gbGFtYmRhICEKICAgIHJldHVybiBmdW5jOwp9Cgp0ZW1wbGF0ZSA8dHlwZW5hbWUuLi4gQXJncz4gdm9pZCBDYWxsYmFjayhzdGQ6OmZ1bmN0aW9uPHZvaWQoQXJncy4uLik+IGYpewogICAgLy8gc3RvcmUgZiBhbmQgY2FsbCBsYXRlcgp9CgppbnQgbWFpbigpCnsKICAgIENhbGxiYWNrKEZGTChbXShpbnQgYSwgZmxvYXQgYil7CiAgICAgICAgLy8gZG8gc29tZXRoaW5nCiAgICB9KSk7CgogICAgcmV0dXJuIDA7Cn0=