File: istreamiterators.yo

package info (click to toggle)
c%2B%2B-annotations 13.02.02-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,576 kB
  • sloc: cpp: 25,297; makefile: 1,523; ansic: 165; sh: 126; perl: 90; fortran: 27
file content (22 lines) | stat: -rw-r--r-- 1,034 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
The hi(istream_iterator)tt(istream_iterator<Type>) can be used to define a set
of iterators for
 hi(istream: iterator) tt(istream) objects. The general form of the
tt(istream_iterator) iterator is:
        verb(    istream_iterator<Type> identifier(istream &in))

Here, tt(Type) is the type of the data elements read from the tt(istream)
stream. It is used as the `begin' iterator in an iterator range. tt(Type) may
be any type for which oprshift() is defined in combination with tt(istream)
objects.

    The default constructor is used as the end-iterator and corresponds to the
 i(end-of-stream). For example,
        verb(    istream_iterator<string> endOfStream;)

The em(stream) object that was specified when defining the
begin-iterator is em(not) mentioned with the default constructor.

    Using tt(back_inserter) and tt(istream_iterator) adapters, all strings
from a stream can easily be stored in a container. Example (using i(anonymous)
tt(istream_iterator) adapters):
        verbinclude(-a examples/istreamiterator.cc)