Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-07-12 14:13:47


Beman Dawes <bdawes_at_[hidden]> writes:

> The old input iterator 24.1.1 had a requirement:
>
> *r++ returned type T, semantics {T tmp= *r; ++r; return tmp; }
>
> The new Single Pass Iterators in N1477 have no such requirement.

That's because the requirement mixes access and traversal.

> That's fine with me - that requirement was a source of bugs in my
> code and violated the rule of least astonishment as far as I was
> concerned.
>
> But before I remove the test from the filesystem library that verifies
> the old input iterator semantics for directory_iterator, I'd like to
> verify that the omission of *r++ was a design decision rather than an
> oversight.
>
> The omission of special requirements for *r++ means that Readable and
> Single Pass = Input, as shown in the diagram, is not actually correct,
> unless I'm missing something. Thus perhaps it should be discussed in
> the paper.

A single-pass iterator is required to support r++ (inherited from the
incrementable iterator requirements), but I guess that we've
unintentionally dropped the requiremnt for *r++ of readable
single-pass iterator, by allowing incrementable iterators to return
any type convertible to const X&. I think it should require that the
return type be X, the Assertion/Note/Precondition/Postcondition column
should be labelled "Operational Semantics" and the lower right entry
should be moved to the middle column. The same goes for the
lower-right entry of each of the following two tables.

I'm going to make those changes; if there are objections, please let
me know ASAP.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk