Boost logo

Boost :

Subject: Re: [boost] Proposal: Monotonic Containers
From: Frank Mori Hess (frank.hess_at_[hidden])
Date: 2009-06-16 17:44:55


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tuesday 16 June 2009, Christian Schladetsch wrote:
> On Wed, Jun 17, 2009 at 12:46 AM, Frank Mori Hess
<frank.hess_at_[hidden]>wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1

> >
> > 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".

No, he didn't. You seem to be confusing c++03 and c++0x.

> 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.

What it means is that a conforming implementation of c++03 can choose to
provide containers which do not even store an allocator object, and which
completely ignore any allocator passed to their constructor. They can choose
to default construct a temporary allocator object whenever they need to do an
allocation or deallocation and then discard it. Your current
monotonic::allocator will fail an assertion when it is default constructed
and attempted to be used for allocation.

I do think your allocator could be useful, it just needs to be paired with
containers that it is guaranteed to work with.

Anyways, I'm beginning to find this thread frustrating and don't intend to
comment further.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAko4ElgACgkQ5vihyNWuA4WaIQCg4EQUpM5+N8mND++7Jhzx1O9d
uY4AnRd00opmUx0sSpLyITtyWigMpwMf
=SkCj
-----END PGP SIGNATURE-----


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