The function
std::list<t>::remove(const T&)</t>
searches the list for an element that is equal to the value being passed. To test equality, it invokes the operator
bool operator==(const T& v1, const T& v2)
or, alternately, the operator
bool T::operator==(const T& v) const
For built-in types such as
int
, the first type of operator is implicitely defined. For user-defined types however it is not. Therefore you must define one of the two forms of this operator yourself:
bool operator==(const mem_list& v1, const mem_list& v2) {
return v1.addr==v2.addr && v1.size==v2.size;
}
struct mem_list {
unsigned int addr;
int size;
bool operator==(const struct mem_size& v) const {
return v.size==size && v.addr==addr;
}
};(