Boost logo

Boost :

Subject: Re: [boost] [Intrusive]
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2017-08-23 22:49:52


On 08/24/17 01:18, Soul Studios via Boost wrote:
>> object is referenced by another API. The only alternative to
>> Boost.Intrusive is keeping a pointer to the object in a separate
>> container, which is way too cumbersome. Second is when you want your
>> object to be a member of multiple containers and you don't want or
>> cannot copy it.
>
> Storing a vector of pointers is not only less cumbersome than injecting
> structures into the original objects,

Having tried both, I will just have to disagree.

> it's less expensive.
> According to the Doom3 BFG technical note
> (fabiensanglard.net/doom3_documentation/DOOM-3-BFG-Technical-Note.pdf)
> a vector of indexes to a separate vector(s) of objects is significantly
> faster than an intrusive list. The same would be true for a vector of
> pointers (but less so).
> This approach is also amenable to multiple containers sharing objects.

Whether that is faster or not depends on many factors, primarilly the
use scenarios at hand. One can't make a general statement like that
without specifics. One factor that could make a vector more efficient
than a list is cache friendliness, but an intrusive list could exploit
it as well if you manage the storage appropriately.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk