|
|
|
|
|
by nly
4193 days ago
|
|
There isn't one. std::list<T> has the same space requirements, memory locality and capabilities of an intrusive list. Period. The naivety of an 'intrusive' list, where all your objects are always 'list ready', is that it allows the insertion and removal of elements without copying them, which is beneficial if your lists experience a lot of churn. The thing is, you can achieve this without intrusion anyway by keeping all your 'not in a list' items... well, in a list. You then get memory management for free and can use splice()[0] to efficiently move nodes around. My philosophy on lists is: if you've never used or needed to splice then you probably don't really need a linked list. Splicing is what linked lists are all about. [0] http://en.cppreference.com/w/cpp/container/list/splice |
|
With intrusive list you need only modify any element on a single place (A bullet location as an example).
How could you achieve this with std::list?