Re: operator= in allocators

From: Mark A. Gibbs (x_gibbsmark_at_rogers.com_x)
Date: 04/04/04


Date: Sun, 04 Apr 2004 01:43:38 GMT

Claudio Puviani wrote:

> 20.1.5 ("Allocator requirements") doesn't state copyability as a
> requirement. Comparison, yes, but definitely not copying.

But that makes no logical sense if containers own their allocator.

vector<int, SomeAllocator> foo()
{
    SomeAllocator a;
    vector<int, SomeAllocator> v(a);
    return v;
}

void bar()
{
    vector<int, SomeAllocator> v = foo();
    // Undefined behaviour
}

And how can the containers not own their own allocator?

mark



Relevant Pages

  • Re: Ada containers and custom allocators
    ... standard storage pool). ... containers manageable. ... course it is the container which would then instantiate the allocator ... Only if you put severe limits on the implementations. ...
    (comp.lang.ada)
  • Re: What would be the right decision?
    ... containers but for a class of containers, ... or all hash tables, etc. ... My suggestion would be that the choice of allocator (and you should ... to change the behavior of all lists. ...
    (comp.lang.c)
  • Re: allocator requirements
    ... >> the allocator for vector at least. ... This seems to directly contradict ... >> several containers with different value types. ... from the standard it cannot have the correct value type for all these ...
    (comp.lang.cpp)
  • allocator question
    ... when passing an allocator to SEVERAL containers at the same time, ... template ... class MyContainer ...
    (microsoft.public.vc.language)
  • allocator question (reposted here... sorry for the mistake)
    ... when passing an allocator to SEVERAL containers at the same time, ... template ... class MyContainer ...
    (microsoft.public.vc.stl)