是std :: list<> :: sort stable吗? [英] Is std::list<>::sort stable?

查看:120
本文介绍了是std :: list<> :: sort stable吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找不到这个问题的任何确定答案。

I couldn't find any definitive answer to this question.

我想大多数实现使用稳定的合并排序,但是是稳定性要求还是副作用?

I suppose most implementation use merge sort that is stable but, is the stability a requirement or a side effect?

推荐答案

C ++标准ISO / IEC 14882:2003说:

C++ Standard ISO/IEC 14882:2003 says:


23.2.2.4/31

23.2.2.4/31

注意:稳定:保留等效元素的相对顺序。如果抛出异常,列表中元素的
顺序是不确定的。

Notes: Stable: the relative order of the equivalent elements is preserved. If an exception is thrown the order of the elements in the list is indeterminate.

这篇关于是std :: list<> :: sort stable吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆