STL set custom sort

前端 未结 4 582
遥遥无期
遥遥无期 2021-01-27 17:03

I was trying to resort a set when i realised that it was impossible to resort a set and i had to create a new set and have a custom sort function to resort it . I researched onl

4条回答
  •  伪装坚强ぢ
    2021-01-27 17:17

    In set the second parameter p2d_sortby_y does not name a type.

    struct point_odered_by_y
    {
        bool operator()(const Point2D& ptd1, const Point2D& ptd2) const
        {
            /* .. */
        }
    };
    
    
    
    typedef std::set pointset;
    pointset s(begin(p2d_set), end(p2d_set));
    

提交回复
热议问题