I would be extremely grateful if somebody could tell me what as I
getting wrong with this little bit of code to find the index of a
particular element in a std::vector
std::vector<int > allVertices ;
getTriangleVert ices(t[0], allVertices) ; //Fills the allVertices vector
getTriangleVert ices(t[1], allVertices) ;
print("All Vertices", allVertices) ;
std::vector<int > tempSpareVertex (getUniqueEleme nts(allVertices )) ;
print("Temp Spare Vertices", tempSpareVertex ) ;
std::vector<int >::const_iterat or it (std::find(allV ertices.begin() ,
allVertices.end (), tempSpareVertex[0]));
int index = it - allVertices.beg in() ;
printf("Spare Vertex 0 Position:- %i \n", index) ;
and the debug shows things like this
All Vertices: 72 6 50 50 6 46
Temp Spare Vertices: 46 72
Spare Vertex 0 Position:- 2
which is clearly the wrong index.
Adam