I have a struct:
and a set of them:Code:struct aCoord { int a,b; };
In one of my functions, I would like to check whether a newly generated aCoord is equivalent to one of the elements already in myCoords (meaning check whether firstCoord.a==secondCoord.a && firstCoord.b == secondCoord.b).Code:std::set<aCoord> myCoords;
I have an iterator and am doing the following:
This doesn't work because I need to overload the comparison function used by find, but despite the research I've done so far, I can't figure out the proper form of the operator override. Can anyone help me out? Thanks.Code:iterator = myCoords.find(newCoord); if(iterator == myCoords.end()) { myCoords.insert(newCoord); }