Boost logo

Boost :

From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2008-06-24 12:01:37

Cory Nelson wrote:
> Say you have a large structure that you only need to build once, and
> won't modify after that except to delete it. Ideally:
> - One arena (what you described) could service all the objects in the
> entire structure. This gives you high locality and no bookkeeping
> overhead.
> - The objects wouldn't hold an allocator (reference to the arena).
> They only need to be built once, so keeping a reference around for
> future allocations is needless overhead.
> - The arena would not be in global/static storage.
> - The objects would all still have their destructors called.
> This is impossible with std:: containers. I've been using C strings,
> wrappers around intrusive (to call destructors), and a tr1::array-ish
> class that lets me set pointer & size.
> A lot of the time the overhead of std:: containers is acceptable for
> the convenience they give, but in my situation (Windows Mobile, need
> to be very tight on usage) it isn't.
> I think the problem is fairly common and even desktop apps would
> benefit from such a design IF it where made convenient. I admit, I
> can't think of a convenient way to do this (though intrusive comes
> quite close).

It does not sound easy to solve, specially if you don't want the arena
to be global/static. Interesting, though.



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