mardi 28 avril 2015

What's wrong with my predicate function?

I'm trying to use "remove_if" method by std::list. I wanna delete the "special" element. Here some code:

Class A {
public: 
void foo(size_t id) {
tasks.remove_if(&A::IsEqual(id)); //Here I have an error
}

private:
std::list<Task> tasks;
struct IsEqual {
    IsEqual(const Task& value) : _value(value) {}
    bool operator() (const size_t id) {
        return (_value._id == id);
    }
    Task _value;
    };
};

Could someone explain where the mistake is?

Aucun commentaire:

Enregistrer un commentaire