Boost logo

Boost :

Subject: Re: [boost] Proposal: Monotonic Containers
From: Christian Schladetsch (christian.schladetsch_at_[hidden])
Date: 2009-06-16 16:01:55


On Wed, Jun 17, 2009 at 12:46 AM, Frank Mori Hess <frank.hess_at_[hidden]>wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Tuesday 16 June 2009, Christian Schladetsch wrote:
> > In truth, this is a non-issue. The code you presented broke the standard;
> > monotonic allocator didn't. Allocators are indeed allowed to have
> > non-static members.
>
> I hate to contradict your prejudices, but std c++03 containers are not
> required by the standard to support allocators which contain state, as has
> been noted several times already in this thread.

I didn't claim that they did. Ross did: "Luckily it seems c++0x will
eliminate that assumption about equal
allocators".

In truth, the standard states that STL implementations are free to treat
allocators of the same type isomorphically. It does not state that
allocators may not have non-static data. That is all that I have claimed
from the start.

What this means practically is that yes, you can write code that breaks one
some platforms (but not all) if you use and attempt to intermix elements
from containers that use allocators that are based on different storage. In
reality, this is rarely a problem.

In any case, the monotonic library as it stands can be and is being safely
used with just one storage and many allocators. If necessary, this can be
enforced by using a static global.

Thanks,
Christian.


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