Name: Anonymous 2009-01-20 5:26
Hello,
I have the following code for sorting a Vector of vertices by their 'x' coordinate value:
(Vertex.h)
...
bool operator<(const Vertex& other) { return (this->x < other.x); }
(elsewhere)
std::vector<Vertex*> vertices;
... //vector is populated
std::sort(vertices.begin(), vertices.end());
This doesn't do the desired sorting, for whatever reason.
Is something wrong with my code?
I have the following code for sorting a Vector of vertices by their 'x' coordinate value:
(Vertex.h)
...
bool operator<(const Vertex& other) { return (this->x < other.x); }
(elsewhere)
std::vector<Vertex*> vertices;
... //vector is populated
std::sort(vertices.begin(), vertices.end());
This doesn't do the desired sorting, for whatever reason.
Is something wrong with my code?