在'C'模板基类之前的预期嵌套名称说明符

时间:2016-06-23 17:25:49

标签: c++ templates c++11

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
    }
};

我收到错误:'C'模板基类

之前的预期嵌套名称说明符

我试过了:FactoryT<T>::registerInternal<C>(className);

但是我收到了这个错误:

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

0 个答案:

没有答案