From 7950366072259419787
X-Google-Thread: f78e5,a5065ede37bcf8d6
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news1.google.com!news3.google.com!news.glorb.com!news-feed01.roc.ny.frontiernet.net!nntp.frontiernet.net!newshosting.com.MISMATCH!nx01.iad01.newshosting.com!newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!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 04:20:31 GMT
Organization: Integrable Solutions
Lines: 55
Sender: mail2news@demon.net
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <m1slwafhni.fsf@uniton.integrable-solutions.net>
References: <1126258566.887901.223500@g43g2000cwa.googlegroups.com> <432442c7$0$749$5fc3050@dreader2.news.tiscali.nl>
NNTP-Posting-Host: news.news.demon.net
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: news.demon.co.uk 1126585253 22233 158.152.254.254 (13 Sep 2005 04:20:53 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Tue, 13 Sep 2005 04:20:53 +0000 (UTC)
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3
X-Greylisting: NO DELAY (Relay+Sender autoqualified);
	processed by UCSD_GL-v2.1 on mailbox7.ucsd.edu;
	Mon, 12 September 2005 08:10:07 -0700 (PDT)
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 j8D4KVoY018839;
	Tue, 13 Sep 2005 14:20:31 +1000 (EST)
X-Path: comp-std-cpp-robomod!not-for-mail
X-NNTP-Posting-Date: Mon, 12 Sep 2005 15:10:01 +0000 (UTC)
X-Delivered-To: std-c++@ucar.edu
X-Spamscanner: mailbox7.ucsd.edu  (v1.6 Aug  4 2005 15:27:38, 0.0/5.0 3.0.4)
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Newsgroups: comp.std.c++
X-MailScanner: PASSED (v1.2.8 96523 j8CFA4dv014723 mailbox7.ucsd.edu)
Xref: g2news1.google.com comp.std.c++:2078

squell@alumina.nl (Marc Schoolderman) 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()).
| 
| I think this example is different from the others, since the input and

Indeed, this example -- which I originally posted to
news:fr.comp.lang.c++ -- is fundamentally different from the 
vector::iterator case.  

In the vector::iterator, it is not hard to offer a definition of
"overlap" that meets common sense such that the assumptions made by
std::copy is violated.

| output ranges don't strictly overlap, yet assigning through the output
| iterator has the side effect of increasing the input range. 

Right, that is the crux of the issue.  Furthermore, back_inserter(l)
does not even belond to the same category as the input.

| This also
| means the complexity requirement of copy() gets violated since it will
| do more than "exactly last - first assignments" -- unless it measures
| "last - first" before it enteres the copy loop, but that would be
| inefficient for bidirectional iterators.

I think "last - first" is flawed because the inputs are InputIterators
for which we do not have such notion.

| > Globally, I think that the wording of the requires clause for
| > copy needs work.  But I can't really think of any reasonable way
| > to formulate what common sense tells me should be the
| > restrictions.
| 
| Perhaps the requirement should be that the output iterator should not
| produce any side effects in the range [first, last)?

Completely agreed -- and it is the suggestion I made on
news:fr.comp.lang.c++.  It would suffice to make the code duplicate the 
content of the list; but it would not suffice to ensure that general
termination, let alone "last - first" assignments.

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



