maniacbug / StandardCplusplus

Standard C++ for Arduino (port of uClibc++)
588 stars 182 forks source link

std::list<T> remove function is not working... #3

Closed devenfan closed 1 year ago

devenfan commented 11 years 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
eric-wieser commented 10 years ago

You need to define bool MyClass::operator==(const MyClass& other). This is not a library bug

maniacbug commented 1 year ago

Thanks, @eric-wieser