Sorting a std::vector> by the string?

后端 未结 4 1376
猫巷女王i
猫巷女王i 2020-11-28 15:25

How can I sort this vector by comparing the pair.first which is an std::string? (without providing a static compare function, nor use

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-28 15:32

    Answer to "duplicate question" of this: link: Sort a vector of pairs by first element then by second element of the pair in C++?

    bool cmp(const pair&x,const pairy){
    if(x.first==y.first){
       return(x.second

提交回复
热议问题