I have a type called Neighbors
:
typedef vector<pair<data,int>> Neighbors;
and here's data
:
struct data
{
int par[PARAMETERS];
int cluster;
bool visited;
bool noise;
};
I'm trying to write a function that inserts values from _NeighborPts
to NeighborPts
(but only ones that aren't already in NeighborPts
):
void insert_unique(Neighbors* NeighborPts, const Neighbors& _NeighborPts)
{
Neighbors_const_it _it = _NeighborPts.begin();
while(_it != _NeighborPts.end())
{
if(/* _it->first.par isn't in *NeighborPts */)
NeighborPts->push_back(*_it);
++_it;
}
}
and i already have a function equal()
which checks if 2 par
s are equal.
So do i have to iterate through NeighborPts
in a while loop and check if the item is found? or could i use some built-in find
or find_if
function to do that for me?