New paper: N3581, Delimited Iterators -- Mike Spertus

A new WG21 paper is available. A copy is linked below, and the paper will also appear in the next normal WG21 mailing. If you are not a committee member, please use the comments section below or the std-proposals forum for public discussion.

Document number: N3581

Date: 2013-03-16

Delimited iterators

by Mike Spertus

Excerpt:

It is extremely tempting to use ostream_iterator to, say, print a vector like:

vector v = {1, 4, 6}; 
cout << "("; 
copy(v.begin(), v.end(), ostream_iterator(cout, ", ")); 
cout << ")"; // Oops! Prints (1, 4, 6, )

The problem is that the “delimiter” in the ostream_iterator constructor call is better described as a suffix than a delimeter.

We offer two alternate proposals.

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.