C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Defect Report: output iterator insufficently constrained

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language, library and standards
View previous topic :: View next topic  
Author Message
chris
Guest





PostPosted: Wed Oct 13, 2004 7:38 pm    Post subject: Defect Report: output iterator insufficently constrained Reply with quote




[ Note: forwarded to C++ Committee. -sdc ]

The note on 24.1.2 Output iterators insufficently 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?

Suggested fix:

Add to the note:

"The values of an output iterator must be assigned to in the order they
are generated. It is undefined to progress forward more than once from a
value of an output iterator which has not yet been assigned."

This is I believe the intension of the existing text. The "progress
forward once" is allowed so that "*r++=t" is allowed. It may be prefered
to instead allow something more along the lines of:

"The values of an output iterator must be assigned to in the order they
are generated. With the exception of '*r++=t', an iterator must always
be assigned to before it is incremented".

Thank you,

Chris


[ 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.jamesd.demon.co.uk/csc/faq.html ]

Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language, library and standards All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.