自定义set比较函数
来源:互联网 发布:js urlencode转码 编辑:程序博客网 时间:2024/05/21 09:11
#include <iostream>#include <set>#include <string>using namespace std;struct node{ int a,b; node(int aa, int bb) {a=(aa),b=(bb);}};struct cmp{ bool operator()(node s1,node s2) { if( s1.a != s2.a ) return s1.a > s2.a; return s1.b>s2.b; }};set<node, cmp>words;int main(){ words.insert(node(1,1)); words.insert(node(2,1)); words.insert(node(3,2)); words.insert(node(4,3)); words.insert(node(5,3)); words.insert(node(5,-2)); set<node>::iterator mbegin; set<node>::iterator mend = words.end(); for( mbegin = words.begin(); mbegin != mend; ++mbegin) cout<<mbegin->a<<" "<<mbegin->b<<endl; return 0;}
0 0
- set自定义比较函数
- 自定义set比较函数
- std::set自定义比较函数
- std::set自定义比较函数
- 自定义std::set比较函数的例子
- map及set中自定义比较函数
- 自定义set<T>的比较函数
- std::set、自定义类型与比较函数
- C++ STL set自定义比较函数
- set集合容器自定义比较函数
- std::set、自定义类型与比较函数
- C++ STL set自定义比较函数
- map和set容器自定义比较函数
- STL中sort、priority_queue、map、set的自定义比较函数
- STL中sort、priority_queue、map、set的自定义比较函数
- STL set重载比较函数
- STL学习(二)set容器学习(二)-自定义比较函数
- 关于set的自定义比较函数的使用及结构体的上下二分用法
- Android NDK中C++ STL库动态和静态链接
- 图片压缩命令
- vs2010下release版本调试设置
- React 入门实例教程
- CodeForces 635C XOR Equation 数学 公式
- 自定义set比较函数
- POJ 1265 pick公式
- HDU 1754 I Hate It 线段树入门
- Ele SOA Container
- 自定义View,绘制自己的手表Demo
- python request属性及方法说明
- 基本类型变量和类型变量+基础
- 8-15比赛总结
- HDU 1698 Just a Hook 线段树 区间更新 惰性标记