mirror of
https://gitlab.com/fbb-git/cppannotations
synced 2024-11-18 10:06:54 +01:00
d84a4013af
git-svn-id: https://cppannotations.svn.sourceforge.net/svnroot/cppannotations/trunk@485 f6dd340e-d3f9-0310-b409-bdd246841980
24 lines
1 KiB
Text
24 lines
1 KiB
Text
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 interator 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) adaptors, all strings
|
|
from a stream can easily be stored in a container. Example (using i(anonymous)
|
|
tt(istream_iterator) adaptors):
|
|
verbinclude(examples/istreamiterator.cc)
|