0

I'm trying to get this to work:

template<template<typename> class... Attributes>
struct Skills
{
    template<class DERIVED>
    struct Create : public Attributes<DERIVED>...
    {};
};

template <class T, class SKILLS>
class Tester : public typename SKILLS::Create<Tester<T,SKILLS>>
{}

but the compiler complains with:

error C2518: keyword 'typename' illegal in base class list; ignored

This works fine if I don't derive within a class template, however.

Is there any chance to derive from the nested template class?

Why do I need that? I'm trying to implement a nicer interface for a CRTP-class template, which allows doing something like:

using MyClass = ClassWithAttributes<Skills<Plus,Minus,Equal,Clear,Size>>
EddyXorb
  • 68
  • 7

1 Answers1

0

You have to write

template <class T, class SKILLS>
class Tester : public SKILLS::template Create<Tester<T,SKILLS>>
{ };

I mean

(1) no typename: in the list of base classes is implicit that the arguments are types

(2) you need template, before Create

(3) use SKILLS as argument of Tester, not Skills, because you have declared the template parameter SKILLS

(4) remember the semicolon at the end of class definition

max66
  • 65,235
  • 10
  • 71
  • 111