dimanche 17 mai 2015

Why is this nested variadic template an invalid parameter?

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.

Aucun commentaire:

Enregistrer un commentaire