Sort vector of vectors

后端 未结 4 1623
离开以前
离开以前 2021-02-13 22:20

I have

    vector> vec 

in my c++ app.

Every vector of integers as an element of \"big\" vector has 4 INT valu

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-13 22:35

    sort(vec.begin(), vec.end(), comp);

    where comp is:

    static bool comp(const vector& vec1, const vector& vec2){
        return vec1[2] < vec2[2];
    }
    

提交回复
热议问题