Boost logo

Boost :

Subject: [boost] [Intrusive]
From: degski (degski_at_[hidden])
Date: 2017-08-23 07:18:19

I having trouble understanding the documentation of Boost.Intrusive. I'm
referring to this section in particular:

"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."

This is confusing, as that might not be true in case of C++11 and up. Does
(or rather, can) move-construction invalidate the use case for Intrusive

"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

But then in the example for slist, it seems from the example code that (a)
pointer(s) to the original object are stored (and makes it look like the
object), but that's not what I read from the quoted text.

class MyClass{
   MyClass *next;
   MyClass *previous;
   //Other members...};
int main(){
   acme_intrusive_list<MyClass> list;

   MyClass myclass;

   //"myclass" object is stored in the list
   assert(&myclass == &list.front());
   return 0;}

I would like to ask for somebody to confirm I'm right, or explain to me in
language (palatable to a thick user) what is actually stored (in terms of

Thanks in advance,


"*Ihre sogenannte Religion wirkt bloß wie ein Opiat reizend, betäubend,
Schmerzen aus Schwäche stillend.*" - Novalis 1798

Boost list run by bdawes at, gregod at, cpdaniel at, john at