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.
question from:
https://stackoverflow.com/questions/30292955/why-is-this-nested-variadic-template-an-invalid-argument 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…