From 7561941693920218387
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,b05362a7d4392b67,start
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2000-12-28 17:19:03 PST
Path: supernews.google.com!sn-xit-02!supernews.com!newsfeed.online.be!newsfeeds.belnet.be!news.belnet.be!newsfeed.icl.net!dispose.news.demon.net!demon!news.demon.co.uk!demon!mail2news.demon.co.uk!not-for-mail
From: Hubert Matthews <hubert@oxyware.com>
Newsgroups: comp.std.c++
Subject: Definition of input iterators
Date: Fri, 29 Dec 2000 01:18:02 GMT
Organization: Oxyware Ltd
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
Message-ID: <3A49DDCC.86CCDD18@oxyware.com>
X-Trace: mail2news.demon.co.uk 978052690 mail2news:11144 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
X-MDaemon-Deliver-To: std-c++@ncar.ucar.edu
Lines: 29
Xref: supernews.google.com comp.std.c++:3126

I've found what I consider to be a problem with the definition of input
iterators in the Standard.  Table 72 states that incrementing an
iterator (using either prefix or postfix ++) may invalidate any copies
of that iterator.  This is a problem when implementing operator++(int),
as it must return a copy of the pre-increment value of the iterator
which may now not be dereferenceable because of the increment.  

Table 72 defines the effect of *r++ to be { T tmp = *r; r++; return tmp;
}.  How is this to be achieved with a user-defined iterator since *r++
must, by the rules of operator precendence, be evaluated as
operator++(int) followed by applying operator*() to a potentially
invalidated iterator?

My suggestion is that incrementing an iterator should guarantee that
copies of that iterator are still dereferenceable but not necessarily
incrementable.  This allows the return from operator++(int) to be used
safely.

Any takers, or am I being overly fussy?

Hubert

---
[ 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                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]



