Boost logo

Boost :

From: scleary_at_[hidden]
Date: 2001-05-14 07:45:05

John -

> Unfortunately, the Standard allocator design is seriously
> broken. I wonder if there is any interest in
> a boost version of STL containers (and a version
> of the default allocator) that fixes this problem.

I agree with you that the Allocator requirements need some re-work. As you
point out, the drawback is the inability of the Standard containers to work
with instance-based Allocators.

Your copy<U> fix is not necessary, though; just use the envelope/letter
idiom (i.e., have an ActualAllocator class, and make your Allocator class be
a sort of ref-counted pointer or something to reference the underlying

I don't see how the default constructors for Allocators are causing problems
-- but I don't see that it's really necessary, either (it could be

> This does mean copying the whole of STL :-)

Yes, and I'm not sure that re-writing the STL is something that a lot of
people here are going to be excited about. I started something similar
based on relaxed copy-construction requirements (so that you could store,
e.g., std::auto_ptr in containers), but re-writing the STL isn't fun. :)

Also, there are problems with requiring all Standard containers to accept
instance-based Allocators, even with empty base optimization -- the
canonical example is "how do you support std::list::splice?"


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