set/multset关联容器 set/multiset 代码 set 将set改成multiset 注意 set/multiset 关联容器set/multiset底层数据结构为红黑树(平衡二叉排序树:左子树值小于根节点小于右子树的值)。set内部元素根据其值自动排序,每个元素值只出现一次,不允许重复。multiset跟set相同,只不过它允许重复元素。 代码 set #include<iostream> #include<set> using namespace std; int main() { set<int> mset; set<int>::iterator it; //插入 mset.insert(