A
Angus
Hi
I have a class CRequest with a function:
bool IsFinished() const;
I have a list of these CRequests - list<CRequest> mylist.
I create a function object to find if a CRequest is finished:
class is_finished : public std::unary_function<CRequest, bool>
{
public:
bool operator() (CRequest req) { return req.IsFinished(); }
};
And I use remove_if like this:
m_RequestList.remove_if(is_finished());
But I get a compile error:
error C2664: 'remove_if' : cannot convert parameter 1 from 'class
is_finished' to 'class std::binder2nd<struct std::not_equal_to<class
CRequest> >'
No constructor could take the source type, or constructor overload
resolution was ambiguous
How can I fix this?
I have a class CRequest with a function:
bool IsFinished() const;
I have a list of these CRequests - list<CRequest> mylist.
I create a function object to find if a CRequest is finished:
class is_finished : public std::unary_function<CRequest, bool>
{
public:
bool operator() (CRequest req) { return req.IsFinished(); }
};
And I use remove_if like this:
m_RequestList.remove_if(is_finished());
But I get a compile error:
error C2664: 'remove_if' : cannot convert parameter 1 from 'class
is_finished' to 'class std::binder2nd<struct std::not_equal_to<class
CRequest> >'
No constructor could take the source type, or constructor overload
resolution was ambiguous
How can I fix this?