How can I build a std::vector and then sort them?

前端 未结 7 2051
一向
一向 2021-02-06 22:09

I have a bunch of strings that I need to sort. I think a std::vector would be the easiest way to do this. However, I\'ve never used vectors before and so would like some help.

7条回答
  •  说谎
    说谎 (楼主)
    2021-02-06 22:54

    litb is correct, as always.

    I just wanted to point out the more general point - anything that can be compared with < can be sorted with std::sort. I'll sometimes sneak an operator< member function into a struct, just so I can do this.

提交回复
热议问题