So I have a class UseCase:
class UseCase {
private:
string entity;
string relationship;
string target;
public:
UseCase();
UseCase(string, string, string);
string getEntity();
string getRelationship();
string getTarget();
};
UseCase::UseCase() {}
UseCase::UseCase(string entity, string relationship, string target) {
this->entity = entity;
this->relationship = relationship;
this->target = target;
}
string UseCase::getEntity() {
return entity;
};
string UseCase::getRelationship() {
return relationship;
};
string UseCase::getTarget() {
return target;
};
I then have a vector<UseCase*>
, containing hundreds of pointers to generated UseCase objects. However, some of these objects contain the same entity
, relationship
and target
attributes. What is the fastest or most efficient way to remove the duplicates from the vector of pointers?
I have done research but I can't find anything relevant to a vector/array of pointers.
Importing a library/using an advanced algorithm is ok. The solution doesn't not need to be simple, only efficient.
Thanks!
Marked as duplicate? This isn't a simple "delete duplicates in vector" question. It's a vector of pointers, and asking how to efficiently detect pointers to objects that are the same, and then delete those objects and the pointers to the object from the vector. I've spent over an hour on here and haven't found a solution