If I define a struct
template Bar
which accepts a template argument:
template <template <int,bool,char> class>
struct Bar {};
I can instantiate it using a struct
template such as Zod
:
template <int,bool,char> struct Zod {};
Bar<Zod> a;
I can also instantiate it using a nested struct
template such as JKL
:
struct GHI {
template <int,bool,char>
struct JKL {};
};
Bar <GHI::JKL> b;
Why can't I instantiate Bar
using a nested variadic struct
template such as DEF
?:
template <typename ...Ts>
struct ABC {
template <Ts ...>
struct DEF {};
};
Bar<ABC<int,bool,char>::DEF> c;
G++ 4.9.2 complains of a type/value mismatch; while Clang 3.4.2's error reports that the template template argument has different template parameters than its corresponding template template parameter.
ABC<int,bool,char>::DEF<4,true,'c'> foo;
works. – BarryDEF
actually takes a non-type template parameter pack. See the example in [temp.param]/p15. – T.C.DEF
's technically parameterized over a non-type parameter pack. And a template template argument taking a pack doesn't match a template template parameter not taking packs. – T.C.