Title
output iterator insufficiently constrained
Status
resolved
Section
[output.iterators]
Submitter
Chris Jefferson

Created on 2004-10-13.00:00:00 last changed 160 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

Change Table 101 — Output iterator requirements in [output.iterators]:

Table 101 — Output iterator requirements
Expression Return type Operational semantics Assertion/note pre-/post-condition
X(a)     a = t is equivalent to X(a) = t. note: a destructor is assumed.
X u(a);
X u = a;
     
*r = o result is not used   Post: r is not required to be dereferenceable. r is incrementable.
++r X&   &r == &++r Post: r is dereferenceable, unless otherwise specified. r is not required to be incrementable.
r++ convertible to const X& {X tmp = r;
++r;
return tmp;}
Post: r is dereferenceable, unless otherwise specified. r is not required to be incrementable.
*r++ = o; result is not used  
Date: 2010-10-21.18:28:33

Rationale:

Solved by N3066.

Date: 2011-03-05.00:04:13

[ 2010 Pittsburgh: ]

Moved to NAD EditorialResolved. Rationale added below.

Date: 2010-10-21.18:28:33

[ 2009-10 Santa Cruz: ]

Move to Ready after looking at again in a larger group in Santa Cruz.

Date: 2010-10-21.18:28:33

[ 2009-10 Santa Cruz: ]

Modified wording. Set to Review.

Date: 2009-07-21.00:00:00

[ 2009-07-21 Alisdair requests change from Review to Open. See thread starting with c++std-lib-24459 for discussion. ]

Date: 2010-10-21.18:28:33

[ 2009-07 Frankfurt ]

Bill provided wording according to consensus.

Date: 2010-10-21.18:28:33

[ Lillehammer: Real issue. There are lots of constraints we intended but didn't specify. Should be solved as part of iterator redesign. ]

Date: 2004-10-13.00:00:00

The note on 24.1.2 Output iterators insufficiently limits what can be performed on output iterators. While it requires that each iterator is progressed through only once and that each iterator is written to only once, it does not require the following things:

Note: Here it is assumed that x is an output iterator of type X which has not yet been assigned to.

a) That each value of the output iterator is written to: The standard allows: ++x; ++x; ++x;

b) That assignments to the output iterator are made in order X a(x); ++a; *a=1; *x=2; is allowed

c) Chains of output iterators cannot be constructed: X a(x); ++a; X b(a); ++b; X c(b); ++c; is allowed, and under the current wording (I believe) x,a,b,c could be written to in any order.

I do not believe this was the intension of the standard?

History
Date User Action Args
2011-03-05 00:04:13adminsetstatus: nad editorial -> resolved
2010-10-21 18:28:33adminsetmessages: + msg2816
2010-10-21 18:28:33adminsetmessages: + msg2815
2010-10-21 18:28:33adminsetmessages: + msg2814
2010-10-21 18:28:33adminsetmessages: + msg2813
2010-10-21 18:28:33adminsetmessages: + msg2812
2010-10-21 18:28:33adminsetmessages: + msg2811
2010-10-21 18:28:33adminsetmessages: + msg2810
2010-10-21 18:28:33adminsetmessages: + msg2809
2004-10-13 00:00:00admincreate