Just want to remove duplicates. Pool is vector<pair<string, int>>
but I seem to miss some elements at the start of the vector somehow. Can anyone verify the logic of the removal? Thanks :)
Pool Master::eliminateDuplicates(Pool generation)
{
for(int i = 0; i < generation.size(); i++)
{
string current = generation.at(i).first;
for(int j = i; j < generation.size(); j++)
{
if(j == i)
{
continue;
}
else
{
string temp = generation.at(j).first;
if(current.compare(temp) == 0)
{
Pool::iterator iter = generation.begin() + j;
generation.erase(iter);
}
}
}
}
return generation;
}