From 6511712307028030337
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,b05362a7d4392b67
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2001-01-04 16:59:03 PST
Path: supernews.google.com!sn-xit-02!supernews.com!news.tele.dk!212.74.64.35!colt.net!dispose.news.demon.net!demon!news.demon.co.uk!demon!mail2news.demon.co.uk!not-for-mail
From: James Kuyper <kuyper@wizard.net>
Newsgroups: comp.std.c++
Subject: Re: Definition of input iterators
Date: Fri,  5 Jan 2001 00:58:43 GMT
Organization: Not Enough
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
Message-ID: <3A53BAA2.BF05E027@wizard.net>
References: <3A49DDCC.86CCDD18@oxyware.com>
X-Trace: mail2news.demon.co.uk 978656330 mail2news:16870 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,de,es,ru
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 25
Xref: supernews.google.com comp.std.c++:3191

Hubert Matthews wrote:
> 
> 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.

You're missing the point - that returned value is the only one that IS
dereferenceable. It didn't exist yet at that the time the operator++()
was executed, and is therefore not at risk. How that's handled
internally by the iterator is up to the creator of the iterator class -
it might involve making copies that in user code would be risky -
however, all the risk is the creator's responsibility. What table 72 is
saying is that the creator is free to invalidate any iterator other than
the one that is returned.

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



