我試圖讓QList在編譯時出現錯誤! 這裏是我的代碼:錯誤:類型/值在模板參數列表中的參數1不匹配'模板<class T>類QList'
class Right
{
public:
Right();
Right(const Right& other);
Right(RightName name, QDate validity_date);
bool isValid() const;
bool operator==(const Right& other)const;
Right &operator=(const Right &other);
QString name;
QDate expiryDate;
};
,然後在的QList
class FileRightsRepo
{
public:
FileRightsRepo(QString rightsPath);
~FileRightsRepo() { }
// IRightsRepo interface
QList<Right> getRights();
private:
QString _rightsPath; // PATH to the file containing rights
};
使用這個權利,我實現這些類,但是當我嘗試編譯,我得到以下異常:
error: type/value mismatch at argument 1 in template parameter list for 'template<class T> class QSet'
QList<Right> getRights();
這是getRights()的返回類型。 我讀過Qt文檔,它指定要使用的對象是可指定類型的,並且我實現了所需的功能。
感謝提前:)
爲什麼錯誤是關於QSet?你確定代碼對應於錯誤嗎? – SergeyA