#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<algorithm>
#include<cstring>
#include<vector>
#include<map>
#include<stack>
#include<set>
#define maxn +50
#define inf 0x7fffffff
#define xiao 1e-9
using namespace std;
set<int>::iterator iter;
int main()
{
int a[]={,,};
set<int> s;
s.insert(a,a+);//与set<int> s(a,a+3); 等效
//s.find()查找set中是否有这个数,iter是它的位置,如果有则返回iter ,没有则返回s.end();
{ if((iter=s.find())!=s.end())
{
cout<<*iter<<endl;
}
}
//insert(first,second) 把定位器first 与second之间的值插入set中 ,返回值为空
{
for(iter=s.begin();iter!=s.end();++iter) cout<<*iter<<" ";
cout<<endl;
}
//insert(key_value)返回值是pair<set<int>::iterator,bool>,bool代表是否插入成功,iterator代表插入的位置,若key_value已经在set中,则iterator返回所在位置
{
pair<set<int>::iterator,bool> pr;
pr=s.insert();
if(pr.second) cout<<*pr.first<<endl;
}
//lower_bound(key_value)返回第一个大于等于key_value的值的位置
//upper_bound(key_value)返回最后一个大于等于key_value的值的位置
{
cout<<*s.lower_bound()<<endl;
cout<<*s.upper_bound()<<endl;
}
return ;
}

set真是一个神奇的东西~~~~~

最新文章

  1. C语言-占位符
  2. C# 读取EXCEL文件的三种经典方法
  3. Hadoop执行作业时报错:java.lang.OutOfMemoryError: Java heap space
  4. Highlighting System
  5. QFtp类参考
  6. linux centos 安装
  7. mybatis include标签
  8. 【CF】7 Beta Round D. Palindrome Degree
  9. oracle 常用博客网址
  10. native跟volatile
  11. SMO(Sequential Minimal Optimization) 伪代码(注释)
  12. HTTP中的URL长度限制(资料整理)
  13. MIT6.828 虚拟地址转化为物理地址——二级分页
  14. Masonry使用详解
  15. [07] ServletContext上下文对象
  16. WIndows下使用Grafana+InfluxDB打造监控系统
  17. 尚硅谷springboot学习26-嵌入式servlet容器自动配置、启动原理
  18. 双网卡Iptables端口转发
  19. Java零基础教程(二)基础语法
  20. Oslo 相机 App

热门文章

  1. javascript oo实现
  2. Python读取内容UnicodeDecodeError错误
  3. Vuejs中关于computed、methods、watch的区别。
  4. (原创)task和function语法的使用讨论(Verilog,CPLD/FPGA)
  5. CCPC_1005
  6. PowerShell批量启动/关闭Azure VM
  7. java并发面试题-基础
  8. SQLAlchemy Script
  9. Ntdsutil.exe
  10. 可拖动jquery插件