0
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);
                                    ^
Lorac
  • 395
  • 1
  • 4
  • 14
  • 2
    `FactoryT::template registerInternal(className);`? – cpplearner Jun 23 '16 at 17:32
  • @cpplearner uhh I do not know this syntax? what does it mean? but it works. – Lorac Jun 23 '16 at 17:34
  • see [where-and-why-do-i-have-to-put-the-template-and-typename-keywords](http://stackoverflow.com/questions/610245/where-and-why-do-i-have-to-put-the-template-and-typename-keywords) – Jarod42 Jun 23 '16 at 17:37

0 Answers0