I have the following structure:
struct dependence {
dependence() {}
dependence(string CUid, LID sink, LID source, std::string var)
: CUid(CUid), sink(sink), source(source), var(var) {}
string CUid;
LID sink = 0;
LID source = 0;
std::string var;
};
Now I want to insert objects of this structure in a set. I have objects with the same CUid
but (important!) the other properties (sink
,source
,var
) can differ. I want to prevent inserting objects with the same CUid
in the set. So the only way I know, is to iterate through the set and check each object of the CUid
. Is there a better way with less code to check for that?