C++STL库之set的用法
2016-10-16 11:50
183 查看
/*set意为集合,是一个内部自动排序不含重复元素的容器*/
输出结果如下:
235
#include<stdio.h> #include<set> using namespace std; int main(){ set<int> st; st.insert(3); st.insert(3); st.insert(2); st.insert(5); //此处不支持it<st.end()这种写法,因为set不支持*(it+i)的访问方式,set只能通过迭代器访问 for (set<int>::iterator it = st.begin(); it != st.end(); it++){ printf("%d", *it); } }
输出结果如下:
235
相关文章推荐
- c++ stl容器set成员函数介绍及set集合插入,遍历等用法举例
- [C++::STL]之set的用法
- C++ STL set集合容器常用用法
- C++ 标准模板库STL中set用法介绍
- c++ stl容器set成员函数介绍及set集合插入,遍历等用法举例
- c++ stl容器set成员函数介绍及set集合插入,遍历等用法举例
- C++ STL set::find的用法
- C++之STL中set的用法 PAT L2-005 集合相似度
- C++之STL中set的用法总结
- C++ STL中set的一些用法
- STL_set用法
- C++ STL之vector用法总结
- C++ Set常用用法
- C++的STL中accumulate的用法
- STL中的常用的vector,map,set,Sort用法
- C++中的STL中map用法详解
- C++ STL常用函数用法
- STL 关联式容器 Set与Map的用法
- C++ STL之map常见用法
- C++ STL常见用法