2013-06-25 36 views
-2

我做了這個類,但它不能在編譯此錯誤:模板函數++要返回另一個容器

expected primary-expression at end of input

爲什麼?

class ContextClass : public QObject 
{ 
    Q_OBJECT 
public: 
    ContextClass(UnitOfWork u, QObject *parent = 0); 

    template <class T> QList<T> table(const QString& filter = QString) 
    { 
     return QList<T>(); 
    } 
}; 
+1

問題即QString默認值必須是即QString()對不起 –

回答

1

嘗試更換:

const QString& filter = QString 

有了:

const QString& filter = QString()