Speed โ€‹โ€‹up capture list

What is the difference in the base hook and element hook in the Boost :: Intrusive library, and when is it better to use another?

I read the documentation on acceleration, but this is inexplicable.

+6
c ++ boost hook
source share
3 answers

As far as I can tell, this is a matter of style and object-oriented design. Base hooks invade the inheritance hierarchy, which requires an additional parent class, public and possibly to impose multiple inheritance. The use of element hooks allows the programmer to consider the object as having a has-a relation to the container, and not an is-a relation to membership in the container.

+3
source share

imho, if your object is intended to be included in only one container, the base hook seems more convenient. Otherwise (for multiple containers) multiple element hooks provide a less ambiguous solution (since they avoid multiple inheritance)

+1
source share

http://www.boost.org/doc/libs/1_47_0/doc/html/intrusive/recursive.html "Element hooks are not suitable for recursive structures"

+1
source share

All Articles