no match for 'operator== ' (operand types are const and 'zItem' const 'zItem'
-
Good evening QT userbase.
I have the following piece of code:
struct zItem { QString Title; QString FileName; public: bool operator==(zItem item) { if (Title == item.Title && FileName == item.FileName) { return true; } return false; } }; QVector<QVector<zItem>> itemList; QVector<QVector<zItem>> itemList2; if (itemList == itemList2) { // private code }I receive the error "no match for 'operator== ' (operand types are const and 'zItem' const 'zItem'".
I do not understand why I get this error or how to solve it. Can anyone help shed some light?
-
@Hamzan-Martinez you have missed const at the end, it should work now
bool operator == (zItem item) const