when i compile i has an error and i cannot understand where is the problem?
class Edge{
public:
int nid;
bool operator==(const Edge& edge) const {
return nid == edge.nid;
}
};
and problem here
vector<Edge> edges;
vector<Edge>::iterator it;
it = find (edges.begin(), edges.end(), nid);
if( it != edges.end() )
edges.erase(it);
any ideas ?!!!?
findwill compare (with==) the objects of typeEdgein the vector withnid. I guess thatnidis of typeintand that won’t work unless you implementoperator==betweenEdgeandint.You can try :