From 625171396345310257
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,8eebfdfe25d22b37
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2001-10-23 14:16:02 PST
Path: archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!btnet-peer0!btnet!dispose.news.demon.net!news.demon.co.uk!demon!mail2news.demon.co.uk!not-for-mail
From: brangdon@cix.co.uk (Dave Harris)
Newsgroups: comp.std.c++
Subject: Re: C++0x: vector::pack()
Date: Tue, 23 Oct 2001 21:15:30 GMT
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
Message-ID: <memo.20011023221640.53147G@brangdon.madasafish.com>
References: <3BD4B660.F3C7606@wizard.net>
Reply-To: brangdon@cix.co.uk
X-Trace: mail2news.demon.co.uk 1003871736 mail2news:26283 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-Orig-NNTP-Posting-Host: host213-1-11-78.webport-cl2-hg4.ilford.mdip.bt.net (213.1.11.78)
X-Orig-X-Trace: fu-berlin.de 1003871617 28767244 213.1.11.78 (16 [57443])
Lines: 29
Xref: archiver1.google.com comp.std.c++:7872

kuyper@wizard.net (James Russell Kuyper Jr.) wrote (abridged):
> 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.

It could be useful to add such a function to the Allocators themselves. 
For example, a list allocator might keep a pool of free blocks which could 
grow large.

    std::list<int> l;
    // ...
    l.get_allocator().pack();

would be a hint for the allocator to return free blocks to the heap it got 
them from. It should just be a hint, in my view, which the allocator (or 
collection) could ignore. 

  Dave Harris, Nottingham, UK | "Weave a circle round him thrice,
      brangdon@cix.co.uk      |   And close your eyes with holy dread,
                              |  For he on honey dew hath fed
 http://www.bhresearch.co.uk/ |   And drunk the milk of Paradise."

---
[ 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                ]



