From 5764783590714440729
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,305abf126cd51bfd
X-Google-Attributes: gidf78e5,public
From: Matt Austern <austern@sgi.com>
Subject: Re: implementing persistence with std library
Date: 1997/07/28
Message-ID: <fxtd8o2lwrc.fsf@isolde.mti.sgi.com>#1/1
X-Deja-AN: 259946919
References: <Pine.OSF.3.95.970727205125.29997A-100000@gonzo.wolfenet.com>
X-Original-Date: 28 Jul 1997 13:58:15 -0700
Organization: SGI
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBVAwUBM90lg0y4NqrwXLNJAQG28QH/TFTLLFIg7wsQydInz8J5GaqbZz6T88Hc 0cPDe0nwTRvYUuHu156DeorKn+X+bu7GIxiV79sJzdQCuMmjfkCBUQ== =91Rf
Newsgroups: comp.std.c++
Originator: austern@isolde.mti.sgi.com


Craig Perras <craigp@wolfenet.com> writes:

> 2 - i've been using SGI's STL library, where they use static functions in
> their allocators. this means you can't actually pass in an allocator
> object, but the static allocate and deallocate functions are used.
> however, i noticed in the standard that you pass in an allocator
> object. passing in an allocator object means you need to keep a reference
> to that object, increasing the size of all containersi (including
> strings!). this size increase may be unacceptable.
> 
> is the SGI implementation conforming to the standard (or, more precisely,
> by a subset of the standard)? i think their implementation is superior -
> there is no space or run-time overhead. the only side-effect is you can't
> use run-time polymorphism. but considering it's an allocator, which
> presumably needs to have good performance, who would want to? 

No, it doesn't precisely conform to the draft standard.

One problem is that allocators as defined in the draft standard are
unimplementable without member templates (take a look at the "rebind"
member), and compilers that support member templates are still
uncommon.  The SGI implementation uses a design that doesn't require
member templates.

The situation with member-specific data in the draft standard is a bit
more complicated.  What it boils down to is that allocators in the
draft are allowed to have non-static member functions, but standard
containers are allowed to assume that they have no member-specific
data.  Containers, as defined in the draft, are allowed to act as if
all allocators of the same type are interchangeable.
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your 
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu 
]



