List 的排序,重载greater<>实现
来源:互联网 发布:java迭代器的使用 编辑:程序博客网 时间:2024/06/07 07:43
#include <list>
#include<algorithm>
#include<time.h>
using namespace std;
typedef struct mystruct
{
int a;
int b;
}mystruct;
template<>
struct std::greater<mystruct>
{
booloperator()( mystruct X, mystruct Y) const
{
return X.a == Y.a ? X.b < Y.b : X.a < Y.a;
}
};
void main()
{
list<mystruct> data;
srand((unsigned)time(NULL));
mystruct StrInfo;
for (int i =0; i < 10 ; i ++)
{
StrInfo.a = 1 + rand() % 10;
StrInfo.b = 1 + rand() % 10;
data.push_back(StrInfo);
}
data.sort(greater<mystruct>());
return;
}
0 0
- List 的排序,重载greater<>实现
- List自定义排序根据Collections.sort重载方法来实现
- List实现Collections帮助类的排序
- 实现List的多列排序
- list排序的三种实现方式
- 关于对List的通用排序实现
- Java List 实现排序的简单方法
- 点击list控件排序的实现
- List排序的两种实现方法
- list排序的三种实现方式
- Collections.sort()实现对List的排序
- Java List重载Collections.sort方法排序
- 实现List<>自定义排序
- List/ArrayList 排序实现
- Comparator实现List排序
- java中的list自定义排序以及倒排序的实现
- Java对象重载排序函数,实现排序
- java中List的排序功能的实现
- instanceof
- The difference between register(寄存器), latch(锁存器) and flip-flop(触发器)
- HDU 1047 Integer Inquiry 大数相加 string解法
- http://www.doudoutxt.com/files/article/51465/728de201.html
- http://www.doudoutxt.com/files/article/51465/759z992.html
- List 的排序,重载greater<>实现
- 黑马程序员21——交通灯管理系统
- 冒泡法排序(汇编语言)
- http://www.doudoutxt.com/files/article/51465/281rs374.html
- ZOJ-3768
- http://www.doudoutxt.com/files/article/51465/632kl918.html
- http://www.doudoutxt.com/files/article/51465/110hi726.html
- 对方还是房间的大富大贵
- Mariadb对中文字符集的支持