Boost: Intrusive and non-intrusive containers

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:


http://www.boost.org/doc/libs/1_37_0/doc/html/intrusive/intrusive_vs_nontrusive.html

0 komentarze:

Prześlij komentarz

 
Tomasz Kulig