STL中List 的sort 比较 用法示例
2010-12-13 15:17
495 查看
#include <string> #include <list> #include <algorithm> #include <iostream> using namespace std; bool op(string str1, string str2) { return str1.length() < str2.length(); } int main(int argc, char* argv[]) { list <string> list_story; list_story.push_back("the"); list_story.push_back("quick"); list_story.push_back("red"); list_story.push_back("fox"); list_story.push_back("jumps"); list_story.push_back("over"); list_story.push_back("the"); list_story.push_back("slow"); list_story.push_back("red"); list_story.push_back("turtle"); list_story.sort(op); for(list<string>::iterator i = list_story.begin(); i != list_story.end(); i++) { cout << *i << endl; } }
相关文章推荐
- STL学习之七:list用法示例
- stl里list的sort()用法
- STL中的常用的vector,map,set,sort, list用法笔记(转)
- stl里list的sort()用法
- STL中的常用的vector,map,set,sort, list用法笔记(转)
- 【vc】【STL源码】vector,deque与sort的用法比较及入门
- STL中的常用的vector,map,set,sort, list用法笔记
- STL中的常用的vector,map,set,sort, list用法笔记 .
- STL 中 sort 函数用法简介
- STL--list用法(二)
- std::vector与std::list的执行速度比较 (C/C++) (STL)
- STL中的常用的vector,map,set,Sort用法
- python中List的sort方法(或者sorted内建函数)的用法
- qsort与sort效率用法比较
- STL中list用法
- STL: LIST中sort和merge的应用(结构体)
- STL 中sort、qsort 的用法
- c++ list, vector, map, set 区别与用法比较
- python中List的sort方法(或者sorted内建函数)的用法
- python中List的sort方法(或者sorted内建函数)的用法