From 5756123597495386971
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,8eebfdfe25d22b37
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2001-10-23 08:52:01 PST
Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!dispose.news.demon.net!news.demon.co.uk!demon!mail2news.demon.co.uk!not-for-mail
From: "Stephen Howe" <NOSPAMsjhowe@dial.pipex.com>
Newsgroups: comp.std.c++
Subject: Re: C++0x: vector::pack()
Date: Tue, 23 Oct 2001 15:51:09 GMT
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
Message-ID: <3bd539f4$0$230$cc9e4d1f@news.dial.pipex.com>
References: <3BD40077.4AB9D0A2@divalsim.it> <3bd464b5$0$8508$ed9e5944@reading.news.pipex.net> <3BD4B660.F3C7606@wizard.net>
Reply-To: "Stephen Howe" <NOSPAMsjhowe@dial.pipex.com>
X-Trace: mail2news.demon.co.uk 1003852297 mail2news:24006 mail2news mail2news.demon.co.uk
X-Complaints-To: abuse@demon.net
X-Mail2News-Path: news.demon.net!mulga.cs.mu.oz.au
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
Lines: 35
Xref: archiver1.google.com comp.std.c++:7863

"James Russell Kuyper Jr." <kuyper@wizard.net> wrote in message
news:3BD4B660.F3C7606@wizard.net...
> Stephen Howe wrote:
> >
> > > The "pack()" function would obviously reallocate the internal array,
> > > thus invalidating all iterators.
> >
> > Why should it do that? I would far rather it returned any excess memory
back
> > to the allocator and shrink the internal array insitu.
>
> There's no reallocate() member in the Table 32 requirements for
> Allocators. How would you go about writing the code for
> std::vector<T,Allocator>::pack() without it?

Right. But I was treating the OP's suggestion as a request and therefore the
allocator would have to support such functionality. As far as I can see,
with the Allocators interface at the moment, it can't be done efficiently.

> For most of the other standard containers, there's considerable less
> reason to bother with such a function. std::vector<T> and std::deque<T>
> are the only ones that routinely have a reason to significantly
> overallocate.

Ok

Stephen Howe


---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]



