I've got two vector objects called A and B. The MyType class does not have a field ID and I want to get the MyType* which are in A but not in B.
Since I do not have an ID need to compare based on the string field.
My object's class looks like this
class Object
{
public:
Object();
string Name;
bool Mode;
string something;
Int range;
}
vector<Object*> a; //asssume filled with objects
vector<Object*> b; //asssume filled with objects
vector<Object*> ret;
Now I want to get diff of (a,b) - all the members that are in a and not b.
How to proceed on this. I tries using strcmp() to do the comparison but it is not working.
Add all the entries of
binto a set. Then try to add all the entries ofainto that set -- each entry that succeeds is an entry that is inabut not inb.If it's the
Nameentries you want to compare, not the pointers, use aset<string>and add theNameentries to the set.