You can pack them in a tuple
, or in a arbitrary empty class template (I prefer to call it pack
):
template<typename... Args>
struct pack { };
template<class T, class... Args>
struct A
{
using args = pack<Args...>;
};
If you are then given A
e.g. in function template and you want to deduce Args...
, you can do it like this:
template<typename... Args, typename A>
void f(pack<Args...>, A a) { /* use Args... here */ }
template<typename A>
void f(A a) { f(typename A::args(), a); }
pack
being empty is convenient in situations like that. Otherwise you'd need some other means to pass args
without actually passing a tuple
that contains data (e.g. wrapping it into yet another empty struct).
Or, in a class template specialization:
template<typename T, typename = typename T::args>
struct B_impl;
template<typename T, typename... Args>
struct B_impl <T, pack<Args...> >
{
// use Args... here
};
template<typename T>
using B = B_impl<T>;
I guess these are the options of deduction and partial specialization that @dyp mentioned.
EDIT This is in response to the edited question. Ok, this is clearly an XY problem. If IntegralSequence
is all you need, you can use std::make_integer_sequence
in C++14 or check my answer to another question just a few minutes ago for an efficient implementation.