I am creating a lua binding in C++11. I want to process each type in a variadic template.
I was thinking I could do something like this, except using Params... represents all of the types inside of it, and not a the next single type inside of it like variadic function parameters do.
template <class T, typename ReturnType, typename... Params>
struct MemberFunctionWrapper <ReturnType (T::*) (Params...)>
{
static int CFunctionWrapper (lua_State* luaState)
{
for(int i = 0; i < sizeof...(Params); i++)
{
//I want to get the next type, not all of the types
CheckLuaValue<Params...>();
//Do other stuff
}
}
};
How would I go about doing this?
You can do this by simply expanding after the function call, into something that can be expanded to.
You can do something else with a lambda. You can even have your
iincrementedNote that the Standard supports putting everything into the lambda. Compiler support until recently (last time I checked) wasn’t very good though