C++ range I/O proposal

Range for made ranges a first-class citizen in C++, but streaming the contents of ranges to/from IOstreams is a clumsy and difficult operation. The canonical way is to use the Algorithms library and stream iterators, but these are difficult to use, and do not handle formatting or error-checking very well.

This proposal is for an extension to the C++ standard library. It proposes range I/O functions, which return range I/O objects that can be used in conventional IOstreams insertion/extraction expressions. They not only make input and output of ranges much, much easier, they also provide facilities not provided by the traditional methods – such as proper handling of stream formatting, and more information about exactly what happened in the last I/O operation.

Contents

  1. Reference
  2. Specification