sorting question

Discussion in 'C++' started by imported_John, Sep 30, 2006.

  1. imported_John

    imported_John New Member

    Joined:
    Sep 30, 2006
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    I have a class

    class Point2D {

    double x[2];

    public:
    ....

    }

    I want to implement a function that can take in as input point2Dsort( double * pdA, int number_of_points) and sort it in lexicographic order. (i.e. if p1.x() > p2.x() then p1 > p2 ...

    Is there a way to define operator< on the point class and implement point2Dsort using c++ sort() function?

    Thanks,
    --j
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice