std::set<int, std::less_equal<int>> myset = {1,1,7,8,2,2};
myset.insert(99);
myset.insert(99);
for(const int & val : myset)
std::cout << val << " ";
输出:
1 1 2 2 7 8 99 99
你好,我在研究容器。我意识到当我使用 less_equal
函数时,标准集容器的行为就像一个多集容器。这是正常的吗?如果是,multiset 和 set 有什么区别?
最佳答案
关于c++ - 关于设置容器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41760306/