I am trying to create a function named Choose
which can take the following as arguments:
template<typename... Args>
class Option
{
Option(Args... arguments)
{
// irrelevant
}
// ...
}
void Foo()
{
Choose(
Option<int, int>(3, 5),
Option<int>(7,123),
Option<int, int, int, int>(1, 2, 3, 4)
);
}
So I have a class with variadic types, and I want to create a function that takes any number of instances of that class, of which every instance can have different
arguments for its types.
I was able to create such a function, where all instances need to have the same arguments for their types:
template <template <typename... Args> class... Opt, typename... Args>
void Choose(EnemyAIState& state, Opt<Args...>... option)
{
// irrelevant
}
void Foo()
{
Choose(state,
Option<int>(1),
Option<int>(2),
Option<int>(3)
);
}
However, I am unable to achieve my final goal, as I cannot find the right syntax
to use. I am hoping you can help me in the right direction.