Anyway, the code below does not make any use of operator(). It usesI meant something else entirely. I was refering to algorithms, such as
std::less<A*>. If that is not specialized in A.h, the remarks below apply.
If it is specialzed, you have to make sure it is a strict total ordering.
find_if where passed predicate, which implemented operator () for
comparison. I assume set uses operator == to locate elements of UDT.
Correct me if am wrong.
Well, if we insert a null pointer into a set, wouldn't it cause anWhat does standard or popular implementation dictate of the following
example:#include<set>
#include "A.h"using std::setint main(int argc, char **argv)
{
std::set<A *aSet;
A *nullA=0;
A *a=new A("NOT HERE")set.insert(new A("something"))
//here is the list of operations I am
aSet.erase(nullA);
null-op: nullA is not in the set.
aSet.erase(a);
null-op: a is not in the set.
//clean up and return
return 0;
}How do standard containers (instantiated with some pointer to user-
defined type) behave in the presence of null pointer?
error whenever the container would try to invoke its member.
Wait, perhaps an std container doesn't do that, hence no errors are to
be seen, then how does find work?