Node:Stream iterators, Next:, Previous:Containers, Up:Top



Stream iterators

To make it possible for algorithmic templates to work directly with input/output streams, appropriate iterator-like template classes are provided. For example,

partial_sum_copy(istream_iterator(cin),istream_iterator(),
                 ostream_iterator(cout, "\n"));

reads a file containing floating point numbers from cin, and prints the partial sums onto cout.