Comparing variadic templates

Viewed 944

If I have two variadic template arguments, A and B, how can I ensure at compile-time that the types of all of the members of A are also the types of a subset of B (in the same order)?

Contrived example:

template<typename...A>
struct Foo {
  template<typename...B>
  static void bar()
  {
  }
}

...

Foo<Apple, Orange>:: template bar<Apple, Orange, Grape>(); // this compiles
Foo<Apple, Orange>:: template bar<Orange, Grape>(); // this doesn't
1 Answers
Related