STL之set/multiset

# 概念

        set和multiset是基于红黑树实现的集合类,set不允许有重复元素,multiset允许有重复元素。使用前需加入头文件# include<set>。

# 常用函数

  • 创建集合
multiset<int> tmp;//创建集合
multiset<int,greater<int>>tmp;//创建降序排列的集合
  • 集合迭代器

tmp.begin()
tmp.end()
  • 集合迭代器解引用
*tmp.begin()
*tmp.end()
  • 插入删除
tmp.insert(100);
tmp.erase(tmp.begin());
原文地址:https://www.cnblogs.com/wanglei5205/p/9176631.html