STL LIST中自定义排序函数例子
来源:互联网 发布:eclipse for linux 32 编辑:程序博客网 时间:2024/05/22 18:40
#include <iostream>#include <list>using namespace std;template<typename kk>class myComp{public: bool operator()(const kk& left,const kk& right) { return left > right; }};int main(){ std::list<int> iList; list <int>::iterator c1_Iter; iList.push_back( 20 ); iList.push_back( 10 ); iList.push_back( 30 ); for ( c1_Iter = iList.begin( ); c1_Iter != iList.end( ); c1_Iter++ ) cout << " " << *c1_Iter; cout << endl; iList.sort(myComp<int>()); for ( c1_Iter = iList.begin( ); c1_Iter != iList.end( ); c1_Iter++ ) cout << " " << *c1_Iter; cout << endl; return 0;}
运行结果
20 10 30 30 20 10Process returned 0 (0x0) execution time : 1.750 sPress any key to continue.
- STL LIST中自定义排序函数例子
- stl list自定义排序准则
- C++ 中list容器,自定义sort排序规则,stl中sort自定义排序规则
- C++ 中list容器,自定义sort排序规则,stl中sort自定义排序规则
- List自定义排序 (例子省份排序)
- STL list中对象排序
- STL list中对象排序
- 【STL】list常用函数的例子
- <STL初探>list节点为自定义类型,如何访问节点中变量和函数,如何使用list自带的排序
- java中List排序 例子
- C++ 中list容器,stl中sort自定义排序规则 注意事项
- stl中排序函数详解
- C++中STL List排序实现
- STL中list结构体元素排序
- STL中list的排序算法
- STL中copy函数使用的例子
- STL list(链表)自定义结构体实现排序
- 关于STL中list的erase()函数
- uva 10115 Automatic Editing(strstr函数查找子串)
- 25个必须记住的SSH命令,你用过了吗?
- mutt+fetchmail+procmail+exim4 邮件服务器
- AOP
- [2013.7.24] 工作日志
- STL LIST中自定义排序函数例子
- SQL Server 2008 安装时,提示不是有效的安装路径
- repeater纵向重复显示数据,即第一列为字段,第二、三、四。。列重复显示数据
- 用Python复制Word内容并使用格式设字体与大小
- hdu3367(最大生成树+最大边+并查集)
- android中设置分割线
- rails3项目解析之3——redis
- 数学在计算机图形学中的应用
- (转)Redhat关闭SELinux和防火墙的办法