I have DefineEvent class template that I use to ease the definition of new event classes. It’s looks like this (pretty hairy, I know):
template<class EventClass, class... Parents>
class DefineEvent : public virtual Event, public Parents...
{
public:
DefineEvent()
{
static const EventTypeInfo& info = TypeInfoParentSetter<EventClass>
::SetOnce<Parents...>(TypeInfoHolder<EventClass>::Instance());
}
};
The TypeInfoParentSetter class I used there looks like this:
template<class EventClass>
class TypeInfoParentSetter
{
public:
template<class... Parents>
static const EventTypeInfo& SetOnce(TypeInfoHolder<EventClass>& holder)
{
// ...
}
};
I get a compilation error pointing to the ::SetOnce<Parents...> line in DefineEvent(), telling me that the compiler “expected primary-expression before ‘…’ token”. How do I fix this?
You can view the code in context here, but take note that it’s pretty ugly.
You need to include one template keyword to denote nested name is template :
and you forgot to make member function
TypeInfoParentSetter<EventClass>::Setstatic :check it: http://ideone.com/sNHMX