Boost logo

Boost :

From: Howard Hinnant (hinnant_at_[hidden])
Date: 2003-08-30 10:32:16


On Saturday, August 30, 2003, at 10:45 AM, Peter Dimov wrote:

> On the other hand, the alternative seems reasonable, too. The
> allocator is
> part of the state (accessor is available), therefore after v1 = v2 v1
> holds
> a2. If I want to retain the allocator I can use
>
> v1.assign(v2.begin(), v2.end());
>
> which works for any v2, not just the specific vector<T, A>.

The reason that this doesn't seem reasonable to me is that allocator
state is not used in comparing the state of the vectors. That is, in
v1 == v2, the state of the allocator is ignored. Therefore it seems to
me that the only reason for the existence of allocator state is to
control the allocation and deallocation of internally allocated memory.
  Therefore any internally allocated memory, coupled with the allocator
that allocated said memory, is effectively (or should be) an atomic
unit, never to be split apart.

-Howard


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