From -4318584050221755369
X-Google-Thread: f78e5,a5065ede37bcf8d6
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news1.google.com!news4.google.com!news.glorb.com!blackbush.cw.net!cw.net!newsfeed01.sul.t-online.de!t-online.de!newsfeed.vmunix.org!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!stump.algebra.com!devnull
From: gcc@integrable-solutions.net (Gabriel Dos Reis)
Newsgroups: comp.std.c++
Subject: =?iso-8859-15?q?Re:_Problems_interpreting_requirement_for_std::?=
 =?iso-8859-15?q?copy_(=A725.2.1)?=
Date: Tue, 13 Sep 2005 05:30:23 GMT
Organization: Integrable Solutions
Lines: 39
Sender: mail2news@demon.net
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <m13bo9zgpc.fsf@uniton.integrable-solutions.net>
References: <1126258566.887901.223500@g43g2000cwa.googlegroups.com> <3qlVe.538$pq6.9733@twister2.libero.it>
NNTP-Posting-Host: news.news.demon.net
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: news.demon.co.uk 1126589439 29780 158.152.254.254 (13 Sep 2005 05:30:39 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Tue, 13 Sep 2005 05:30:39 +0000 (UTC)
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3
X-Virus-Scanned: amavisd-new at cs.mu.OZ.AU
X-Received: (from fjh@localhost)
	by mulga.cs.mu.OZ.AU (8.12.10+Sun/8.12.9/Submit) id j8D5UNlk002854;
	Tue, 13 Sep 2005 15:30:23 +1000 (EST)
X-Path: comp-std-cpp-robomod!not-for-mail
X-NNTP-Posting-Date: Tue, 13 Sep 2005 05:22:34 +0000 (UTC)
X-Delivered-To: std-c++@ucar.edu
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Newsgroups: comp.std.c++
Xref: g2news1.google.com comp.std.c++:2084

AlbertoBarbati@libero.it (Alberto Ganesh Barbati) writes:

| kanze wrote:
| > 
| > Finally, what about something like:
| > 
| >     copy( l.begin(), l.end(), back_inserter( l ) ) ;
| > 
| > I think that, realistically, this will generally result in an
| > endless loop.  And yet, it requires quite a stretch of the
| > imagination to say that back_inserter( l ) is in the range of
| > [l.begin(),l.end()).
| 
| It doesn't result in an endless loop, because l.end() is not
| re-evaluated during the execution of copy.

the "because" part is irrelevant.  See below.

And James' claim that the l.end() is invalidated is bogus.

| The value which is passed as
| the "last" parameter remains a valid iterator which keeps pointing to
| the same element for the whole execution of the algorithm. Therefore the
| statement will effectively just append a entire copy of l at the end of
| l itself.

Consider this:

    p = l.end();
    l.push_back(8);
    q = l.end();
    assert (p == q);

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



