Oct 24, 2021

[C++][data structure] intrusive container

Reference:
https://www.boost.org/doc/libs/1_76_0/doc/html/intrusive/intrusive_vs_nontrusive.html

The main difference between intrusive containers and non-intrusive containers is that in C++ non-intrusive containers store copies of values passed by the user. Containers use the Allocator template parameter to allocate the stored values.

On the other hand, an intrusive container does not store copies of passed objects, but it stores the objects themselves.

The additional data needed to insert the object in the container must be provided by the object itself.

For example, to insert MyClass in an intrusive container that implements a linked list, MyClass must contain the needed next and previous pointers.




No comments:

Post a Comment

Note: Only a member of this blog may post a comment.