mardi 24 février 2015

Get list of parameter types from function

I have banged my head during the afternoon and night trying to get a list of parameter types from a function pointer. I can get the individual parameter types with solutions like the one proposed for example here: How do I get the argument types of a function pointer in a variadic template class?, but that breaks as I don't know how many, if any, parameters are used.


I have the following (cut down) function:



void LuaWrapper::Register(const char* aFunctionName, Ret(*aFunctionType(Args...))
{
//I can get the return value via typeid(Ret).name()
//I would like to be able to do something like typeid(Args...).name() to get a list of all parameter types
}


Is what I'm asking for impossible, or am I just dense?


Aucun commentaire:

Enregistrer un commentaire