mardi 17 décembre 2019

How to use result_of with function typedef

Let's say I have something, following the example on cppreference.com, but specified differently:

typedef double call_t(char, int&);

I need such a form of invocation of result_of that would give back the return type of the function signature defined as the above call_t. That is something that I could use as:

template <class Signature>
std::result_of<SOME_MAGIC_AROUND(Signature)>::type call(Signature* f)
{
    return (*f)();
}

double d = call(fn); // where `fn` is declared as having `call_t` type

Doing result_of<call_t>::type doesn't work. I've tried also various combinations around it, but came to nothing.

Aucun commentaire:

Enregistrer un commentaire