Trying to understand this bit of code using variadic templates:
template <typename... T>
struct FooGroup;
template <typename... FooTypes, typename... BarTypes>
struct TEST<FooGroup<FooTypes...>, BarGroup<BarTypes...>>
I know variadic templates allows you to pass in unknown type of unknown amount. However, this is confusing to me. Can anyone shed some light?
This code
template <typename... T>
struct FooGroup;
declare FooGroup
as a struct
that receive a variadic list of type template parameter.
template <typename... FooTypes, typename... BarTypes>
struct TEST<FooGroup<FooTypes...>, BarGroup<BarTypes...>>
is part of template specialization.
I suppose that TEST
is declared as follows
template <typename, typename>
struct TEST;
so receiving two template types parameter.
With
template <typename... FooTypes, typename... BarTypes>
struct TEST<FooGroup<FooTypes...>, BarGroup<BarTypes...>>
you declare a partial specialization of TEST
in case the first template parameter is in the form FooGroup<FooTypes...>
(where FooTypes...
is a variadic list of template parameters) and the second template parameter is in the form BarGroup<BarTypes...>
(where I suppose BarGroup
is defined almost as FooGroup
and BarTypes...
is another variadic list of template parameters)