From -6114219376881289260 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f78e5,c66ceaccc8f25e6b X-Google-Attributes: gidf78e5,public X-Google-ArrivalTime: 2002-04-06 08:31:25 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!212.74.64.35!colt.net!dispose.news.demon.net!news.demon.co.uk!demon!mail2news.demon.co.uk!not-for-mail From: xleobx@qmailcomq.com Newsgroups: comp.std.c++ Subject: Re: Allocators, standard containers, and assignment Date: Sat, 6 Apr 2002 16:25:54 GMT Organization: Verio Approved: Fergus Henderson , moderator of comp.std.c++ Message-ID: 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> <3CAE478F.ECDBDB2C@wizard.net> X-Trace: mail2news.demon.co.uk 1018110358 mail2news:6642 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) User-Agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (FreeBSD/4.4-RELEASE (i386)) NNTP-Posting-Date: Sat, 06 Apr 2002 03:01:06 GMT Lines: 38 Xref: archiver1.google.com comp.std.c++:10418 James Kuyper Jr. wrote: >> 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. int a = 5; // allocation strategy: data segment void foo() { int b; // allocation strategy: stack b = a; ... } Are you surprized that `b' dies at the end of foo()? I don't think so. Why should other objects be any different? Allocation strategy is presumed to be a part of an object's type, not part of an object's state. > 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. Memory management will be a nightmare. Memory pools tend to have limited lifetime. If the allocators can be swapped or assigned, you hardly can be sure if there are no references to an allocator whose memory pool is about to go away, from objects that you have no control over. Leo --- [ 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 ]