Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Sort Vector of Objects (c++)

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?

Name: Anonymous 2009-01-20 6:52

>>3

just fuck off

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List