replace、remove、random_shuffle是不是支持关联容器

replace、remove、random_shuffle是否支持关联容器?replace、remove、random_shuffle是否支持关联容器?[解决办

replace、remove、random_shuffle是否支持关联容器?
replace、remove、random_shuffle是否支持关联容器?
[解决办法]
不可以,关联容器不允许交换两个不同迭代器中的内容。

为了避免破坏关联容器中元素的顺序关系,map和multimap的value_type都是pair<key_type const, data_type>,里面的const会阻止你进行赋值。而set和multiset通常会让iterator等同于const_iterator。