|
Boost : |
From: Douglas Gregor (gregod_at_[hidden])
Date: 2001-07-06 12:06:29
On Friday 06 July 2001 12:14, you wrote:
> On Fri, 6 Jul 2001, David Abrahams wrote:
> > But whether it increments or not is not in question.
> >
> > The question is, if I dereference an input iterator twice without
> > intervening operations, do must I get the same result?
>
> I understrand that. The question is about iterators. Iterators
> are used in algorithms to iterate over (pseudo)sequences. For
> input iterators, increment must move the iterator and dereference
> must not. Dereferencing an input iterator twice must give the
> same element of the (pseudo)sequence. Whether that element has
> a stable value has nothing to do with the iterator.
From which stated input iterator requirements (i.e., clause/table in the C++
standard) do you conclude this?
> Let's ask the same irrelevant question about random access iterator.
A random access iterator is a much more specific concept than an input
iterator, so the example is irrelevant to the question :)
A random access iterator refines a forward iterator; forward iterators are
multipass (see 24.1.3p2), and therefore the result of dereferencing a forward
iterator is stable. Random access iterator adheres to the requirements of
forward iterator, so of course it is stable.
But all this doesn't matter because an input iterator is not necessarily a
forward iterator.
[code snip]
>
> John
Doug
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk