5 ms·
I don't get it, just use `list<person>`. The prev and next pointers live next to the person objects right in the same node, no need for intrusive pointer. edit
by leni536 4y ago
I don't get it, just use `list<person>`. The prev and next pointers live next to the person objects right in the same node, no need for intrusive pointer.
edit: The author assesses that this is somehow bad for person objects that are expensive to copy. But std::list has splicing operations, and since C++11 it has emplace as well, so this doesn't apply.
- esprehn 4y agoThere's no way to use that optimization if you need to be in two or more lists at the same time.
- lumost 4y agoWouldn't std shared pointer handle that case?
- john_fushi 4y agoWhich is also an issue in the author's example, no? So the point would be moot.