I have some variadic template method, which looks like this:
template<typename ... Args>
void Invoke(const char* funcName, Args ... args) const;
template<typename ... Args>
void Invoke(const char* funcName, Args ... args) const
{
SPrimitive params[] = { args ... };
SomeOtherInvoke(funcName, params, sizeof ... (Args));
}
Here SPrimitive - just a simple struct with a constructor for any primitive type.
I want to make one more Invoke definition for some complex type. And here is my question: Is it possible to make variadic template method specialization in c++ 11/14 ? I mean something like this ( for simplicity lets my type will be int):
template<int ... Args>
void Invoke(const char* funcName, Args ... args)
{
int params[] = { args ... };
SomeComplexInvoke(funcName, params, sizeof ... (Args));
}
Here I want a specialization, which takes any parameters count of type int, so I can call it just like this:
Invoke("method", 2, 4 ,9);
Aucun commentaire:
Enregistrer un commentaire