std::set 使用不同数据结构的实现

Implementation of std::set using different data structures

受到这个问题的启发: I came up with one of my own. Is red-black tree the only possible data structure fullfilling requirements of std::set or are there any others? For instance, another self-balancing tree - AVL tree - 似乎是具有非常相似属性的不错选择。 std::set 的底层数据结构在理论上是可以替代的还是有一组需求使得红黑树成为唯一可行的选择?

在大多数现实世界的情况下,AVL 树的性能(不要与渐近复杂性混淆)比 RB 树差。您可以 std::set 基于 AVL 树并完全符合标准,但它不会为您赢得任何客户。