在 C++ std::multiset 是否保持稳定的排序顺序?

发布于 2024-07-13 00:19:25 字数 201 浏览 5 评论 0原文

假设我有两个项目 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

郁金香雨 2024-07-20 00:19:25

此线程暗示当前标准不保证它,但所有已知的当前实现都满足它,并提供了包含保证的 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文