From -3974624439305033918 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f78e5,c66ceaccc8f25e6b X-Google-Attributes: gidf78e5,public X-Google-ArrivalTime: 2002-04-05 18:13:08 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: "James Kuyper Jr." Newsgroups: comp.std.c++ Subject: Re: Allocators, standard containers, and assignment Date: Sat, 6 Apr 2002 02:12:24 GMT Organization: Giganews.Com - Premium News Outsourcing Approved: Fergus Henderson , moderator of comp.std.c++ Message-ID: <3CAE478F.ECDBDB2C@wizard.net> References: <42aba677.0203291151.ff4f74c@posting.google.com> <3ca4e319$0$20850$724ebb72@reader2.ash.ops.us.uu.net> <42aba677.0204051121.59ee7aca@posting.google.com> <3cae209e$0$19654$4c41069e@reader1.ash.ops.us.uu.net> X-Trace: mail2news.demon.co.uk 1018059148 mail2news:101 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-Accept-Language: en MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Date: Fri, 05 Apr 2002 18:45:17 CST X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-Info: Please be sure to forward a copy of ALL headers X-Abuse-Info: Otherwise we will be unable to process your complaint properly Lines: 36 Xref: archiver1.google.com comp.std.c++:10416 "P.J. Plauger" wrote: > > "Kevin S. Van Horn" wrote in message > news:42aba677.0204051121.59ee7aca@posting.google.com... > > > > However it may seem to you, we did discuss this within the committee. > > > An allocator for a container is fixed at construction (to the extent that > > > you can tell). > > > > Why in the world was such a decision made? What benefit is there from such > > a choice? > > You get to determine what allocation strategy goes with each object. > It doesn't change in surprising ways as the result of swaps and > assignments. That depends upon what suprises you. I'd be surprised if the allocation strategy was NOT swapped or assigned along with the rest of the object. > > I've already mentioned one great disadvantage of such an approach: > > swap is needlessly complicated and made expensive in some circumstances. > > The circumstances are exactly when it might be wise to reallocate copied > elements, because they have to live in a different memory pool. If the allocators were swap()d, along with the rest of the container's contents, there'd be no need for reallocation. splice() is the only case where reallocation would be needed when using an allocator with inequivalent instances. --- [ 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.jamesd.demon.co.uk/csc/faq.html ]