stl 排序 - 严格弱排序

2022-01-07 00:00:00 algorithm c++ stl strict-weak-ordering

为什么 STL 使用 严格弱排序的比较函数?为什么不能偏序?

Why does STL work with a comparison function that is strict weak ordering? Why can't it be partial ordering?

推荐答案

A 部分顺序不足以实现某些算法,例如排序算法.由于偏序集合不一定定义集合中所有元素之间的关系,那么如何对偏序内没有顺序关系的两个项目的列表进行排序?

A partial order would not be sufficient to implement some algorithms, such as a sorting algorithm. Since a partially ordered set does not necessarily define a relationship between all elements of the set, how would you sort a list of two items that do not have an order relationship within the partial order?

相关文章