jeudi 23 juin 2016

Expected nested-name-specifier before 'C' template base class [duplicate]

This question already has an answer here:

template <class BASECLASS = P>
class FactoryT : public Factory
{
    public:
     template <typename C>
     static void Register(const QString& className = C::sClassName())
     {
        // this compile-time "assert" ensures that C is a sub-class of BASECLASS
        BASECLASS* test = ((C*)NULL);
        sInstance->Factory::registerInternal(className, &construct<C>);
     }

  protected:
    template <typename C>
    void registerInternal(const QString& className = C::sClassName())
    {
        BASECLASS* test = ((C*)NULL);
        Factory::registerInternal(className, &construct<C>);
    }

}


template <typename T>
class FactoryTFriend : public FactoryT<T> {
public:
    FactoryTFriend() : FactoryT<T>() {}

    template <typename C>
    void registerInternal(const QString& className = C::sClassName())
    {
        FactoryT<T>::registerInternal<typename C>(className); // THIS LINE
    }
};

I get the error : Expected nested-name-specifier before 'C' template base class

I tried this : FactoryT<T>::registerInternal<C>(className);

But I get this error :

error: expected primary-expression before '>' token
         FactoryT<T>::registerInternal<C>(className);
                                    ^

Aucun commentaire:

Enregistrer un commentaire