c++ stl set 有序性

stl 中的set 是有序容器,能够经过传入自定义比较器函数对象的方式,设定想要使用的比较方法。web 使用迭代器遍历set的时候,遍历的顺序就是set 中比较器定义的顺序。svg set<int> s; // 插入的时候按照从大到小的顺序插入 for (int i = 10; i > 0; i--) { s.insert(i); } set<int>::iterator it; // 遍
相关文章
相关标签/搜索