在 C++ std::multiset 是否保持稳定的排序顺序?
假设我有两个项目 a 和 b,它们比较相同。 所以一个< b 为假,并且 b < a 为假。 如果这些项目作为键插入到 std::multiset (或 std::multimap)中,我是否能保证它们的最终排序顺序?
我检查了一些参考资料,但找不到答案。 我很想认为没有任何保证,并且取决于每个特定的实现。
谢谢。
Suppose I have two items, a and b, that compare the same. So a < b is false, and b < a is false. If these items are inserted into a std::multiset (or std::multimap) as keys, do I have any guarantees of their final sorted order?
I've checked a couple of references, but I couldn't find the answer. I'm tempted to think that there are no guarantees and that it's left up to each particular implementation.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此线程暗示当前标准不保证它,但所有已知的当前实现都满足它,并提供了包含保证的 C++0x 草案标准的链接。
This thread implies that it is not guaranteed by the current standard but is met by all known current implementations, and gives a link to the C++0x draft standard that includes a guarantee.