基础-Sort函数

Posted on 2015-07-10 00:06  指尖敲击流逝的岁月  阅读(113)  评论(0)    收藏  举报

Sort elements in range
Sorts the elements in the range [first,last) into ascending order.
The elements are compared using operator< for the first version, and comp for the second.
Equivalent elements are not guaranteed to keep their original relative order (see stable_sort).

 
调用sort,引用头文件:#include <algorithm>
调用less(从小到大),greater(从大到小),引用头文件:#include <functional>
同时对于char等类型排序也是可以的。