访问在avl_set一个节点的左子或右子 [英] Accessing left child or right child of a node in avl_set

查看:149
本文介绍了访问在avl_set一个节点的左子或右子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道的std ::设置是一个平衡树,和标准C ++禁止访问节点的孩子在的std ::设为,但我想知道是否可以在升压的库访问的孩子和家长一个节点在 avl_set 。如果它不可能,有没有像的升压的包含自我平衡的树,它允许这种行为?任何可靠的库

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 access the children and parent of a node in an avl_set in boost library. If its not possible, Is there any reliable libraries like boost that contains self balanced trees that allows such actions?

推荐答案

是的,升压包含一个AVL树实现(和它的一些变种,IIRC)。

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

这是升压侵入库的一部分。这个库的语义可以是一个有点不寻常,如果你已经习惯了常规(标准库)的容器中。

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.

在事实上图书馆配备了许多相互竞争的树算法,可以通过选择不同的模板参数类型切换。请参见 http://www.boost.org/doc/库/ 1_58_0 / DOC / HTML /侵入/ node_algorithms.html

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.

这篇关于访问在avl_set一个节点的左子或右子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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