STL set,mulityset用法
2024-10-10 17:16:29
#include<iostream>
#include <set>
using namespace std;
template <class T>
class RuntimeCmp
{
public:
enum cmp_mode {normal,reverse};
private:
cmp_mode m_mode;
public:
RuntimeCmp(cmp_mode m = normal):m_mode(m){};
bool operator () (const T& t1,const T& t2)
{
return m_mode == normal ? t1 < t2 : t1>t2;
}
bool operator == (const RuntimeCmp& rc)
{
return m_mode = rc.m_mode;
}
}; typedef std::set<int,RuntimeCmp<int>> IntSet; int _tmain(int argc, int argv[])
{
IntSet intSet;
intSet.insert();
intSet.insert();
intSet.insert();
int aa = ; } set是使用树结构来实现的。
最新文章
- 来自 Thoughtram 的 Angular 2 系列资料
- 大型网站一致性的基础理论---CAP/BASE
- Smarty 配置文件的读取
- android 串口调试
- delphi 菜单的项目是否可用
- javascript editor
- wamp配置虚拟主机
- JVM监控概述(图文)
- 华硕 F1A55-M LX3系列跳线图
- Python(2)深入Python函数定义
- 三十七、小程序页面跳转传参参数值为url时参数丢失
- 【安全性测试】利用反编译查看对应activity的方法采用hook技术绑定劫持_入门
- 背水一战 Windows 10 (115) - 后台任务: 通过 toast 激活后台任务, 定时激活后台任务
- Quartz Cron表达式详解
- OO博客作业1:第1-3周作业总结
- JAVA深入研究——Method的Invoke方法(转)
- python 的正则表达式
- Go语言_range(范围)理解
- String int 相互转换
- 为什么推荐你用 Kotlin语言?
热门文章
- 如何用jar命令生成可执行的jar文件
- Android 性能优化 SparseArray【转载】
- winform clickonce在线安装
- 吴裕雄 21-MySQL 正则表达式
- &#39;Could not find first log file name in binary log index file&#39;的解决办法
- ROC,AUC,Precision,Recall,F1的介绍与计算(转)
- CSS 盒子大小
- @Component单例与并发(未解决)
- idea 设置 转自 https://www.cnblogs.com/jajian/p/8136672.html
- centos7 关闭 防火墙