STL-multiset

简介

multiset 与 set 类似,为标准模板库容器的一部分

multiset 容器和 set 容器唯一的差别在于,multiset 容器允许存储多个值相同的元素,而 set 容器中只能存储互不相同的元素,且其底层为红黑树,multiset 所有元素为 const 特性,即不允许修改,但可以插入和删除

multiset为关联式容器,底层为红黑树(RB-Tree)

类模板

1
2
3
4
5
template<
class Key, //数据类型
class Compare = std::less<Key>, //排序方法
class Allocator = std::allocator<Key> //分配器
> class multiset;

其成员函数,迭代器等与 set 无异