
Zitat von Jonathan Franklin
On Thu, Nov 5, 2009 at 9:31 AM, Roman Shmelev
wrote: I want the following type of pool in the wishlist: Allowing to allocate misc-size memory blocks without an ability to delete them (I mean they will are deleted on pool destruction). I met some situations where such pool was really what needed.
I actually did this at one time w/ the boost::pool by making my requested_size 1 byte, then doing an ordered_malloc(num_bytes).
I'm not claiming that this is a good or a bad idea. But it did work.
I think roman's point was the automatic destruction of different object types on pool destruction. an implementation of that would e.g. look like this: struct object_base{ virtual ~object_base() = 0; virtual object_base *next() = 0; }; template<class T> struct object : object_base{ T user_object; virtual ~object(){} virtual object_base *next(); //returns this + 1 and takes care of alignment }; with new objects just added to the end of the block.