Re: allocator requirements

From: Jonathan Turkanis (technews_at_kangaroologic.com)
Date: 07/09/04


Date: Fri, 9 Jul 2004 15:21:25 -0600


"John Harrison" <john_andronicus@hotmail.com> wrote in message
news:opsav1xfa5212331@andronicus...
> On Fri, 09 Jul 2004 20:47:16 GMT, P.J. Plauger <pjp@dinkumware.com>
wrote:
>
> > "John Harrison" <john_andronicus@hotmail.com> wrote in message
> > news:opsavy7sdb212331@andronicus...
> >
> >> If you specify an allocator in an STL container is it a
requirement that
> >> the allocator allocates object of the right type,
> >
> > Yes, according to the C++ Standard.
> >
> >> or can you
assume that
> >> the container will rebind the allocator to the correct type?
> >
> > Yes, according to widespread practice.
> >
> > P.J. Plauger
> > Dinkumware, Ltd.
> > http://www.dinkumware.com
> >
>
> Yes it seems so, both implementations of the STL I've checked do
rebind
> the allocator for vector at least. This seems to directly contradict
the
> requirements for allocator_type.

How does this contradict the allocator requirements?

> I also noticed that Josuttis' book also ignores what the standard
says,
> see first page of chapter 15 where he happily passes the same
allocator to
> several containers with different value types.

It looks to me like the allocators he uses all have value_types
appropriate for the containers.

Jonathan



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: 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 (reposted here... sorry for the mistake)
    ... when passing an allocator to SEVERAL containers at the same time, ... template ... class MyContainer ...
    (microsoft.public.vc.stl)
  • allocator question
    ... when passing an allocator to SEVERAL containers at the same time, ... template ... class MyContainer ...
    (microsoft.public.vc.language)
  • Re: basic_string ref across dlls
    ... > by all the containers in STL so we do not worry about this DLL problems? ... Yes, you can write your own allocator, but you have to remember to supply ...
    (microsoft.public.vc.stl)