Closed devenfan closed 1 year ago
My Class Name: MyClass
Here is the code:
class MyCollection { private: std::list<MyClass> m_list; public: MyCollection() : m_list() { } void addMyClass(const MyClass & myClass) { m_list.push_back(myClass); } void addMyClass(const MyClass & myClass) { m_list.remove(myClass); //Error is occurred here } }
Below is the error description:
StandardCplusplus-master/list:661: error: no match for 'operator==' in 'temp.std::list<T, Allocator>::iter_list::operator* [with T = MyClass, Allocator = std::allocator<MyClass>]() == value' make: *** [MyLib.o] Error 1
You need to define bool MyClass::operator==(const MyClass& other). This is not a library bug
bool MyClass::operator==(const MyClass& other)
Thanks, @eric-wieser
My Class Name: MyClass
Here is the code:
Below is the error description: