Three questions:
Tail should be a variable list of templates, not types. Therefore, it should be
template<int> class... Tail
instead
typename... Tail
and you need to explicitly expand the parameter package with private C<Tail...> instead of private C<Tail> .
And you will need to implement the basic case when Tail... empty:
// base case template < template <int> class Head> struct C<Head> : public Head<1> { };
(This is a compilation for Clang 3.0)
Now the whole piece of code:
template<int OFFSET> struct A { enum O { offset = OFFSET }; }; template < template <int> class Head, template<int> class... Tail> struct C : public Head<1>, private C<Tail...> { }; template < template <int> class Head> struct C<Head> : public Head<1> { }; int main() { C< A, A > c1; return 0; }
source share