Accessing left child or right child of a node in avl_set

前端 未结 1 1948
礼貌的吻别
礼貌的吻别 2021-01-15 12:53

I know that std::set is a balanced tree, and standard C++ forbids accessing the children of a node in std::set, But I was wondering if one can acce

相关标签:
1条回答
  • 2021-01-15 13:24

    Yes, boost contains an avl tree implementation (and some variants of it, IIRC).

    • http://www.boost.org/doc/libs/1_58_0/doc/html/intrusive/avl_set_multiset.html#intrusive.avl_set_multiset.avl_set_multiset_hooks

    That is part of of the Boost Intrusive library. The semantics of this library can be a bit unusual if you're used to regular (standard library) containers.

    In fact the library comes with many competing tree algorithms, that you can switch by selecting a different template argument type. See http://www.boost.org/doc/libs/1_58_0/doc/html/intrusive/node_algorithms.html


    Also note that Intrusive Containers are - by there very nature - very open. You can inspect the node hooks, or, in fact, replace them with your custom value traits which brings the pointer layout completely under your control.

    0 讨论(0)
提交回复
热议问题