I have used find_if before with lists and vectors in C++ and it has worked fine. But now, when I try to use it with sets I get the following error:
error: no matching function for call to ‘find_if(std::set<A, Acmp>::iterator,
std::set<A, Acmp>::iterator, <unresolved overloaded function type>)’|
My class is the following:
bool searchForA(A i) {
return (i.getVal() > 0);
}
void B::findA()
{
set<A, Acmp> cont;
set<A, Acmp>::iterator it;
A *a1 = new A(5);
A *a2 = new A(7);
cont.insert(*a1);
cont.insert(*a2);
it = find_if (cont.begin(), cont.end(), search)
}
Can anyone help me understand where is the problem?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…