"Jerry Coffin" <jc*****@taeus. com> wrote in message
news:11******** *************@c 13g2000cwb.goog legroups.com...
I don't get it quite. Especially this part:
(std::istream_i terator<std::st ring>(iss)),
std::istream_it erator<std::str ing>());
The first is an iterator to read strings from the input stream iss. The
second is what I'd call an EOF-iterator --
From 14882:
istream_iterato r();
1 Effects: Constructs the end*-of-*stream iterator.
Now you know what to call it. :-)
The details, for anyone interested:
24.5.1 Template class istream_iterato r
1 istream_iterato r reads (using operator>>) successive elements
from the input stream for which it was constructed. After it
is constructed, and every time ++ is used, the iterator reads
and stores a value of T. If the end of stream is reached
( operator void*() on the stream returns false), the iterator
becomes equal to the end*-of-*stream iterator value. The constructor
with no arguments istream_iterato r() always constructs an end of
stream input iterator object, which is the only legitimate iterator
to be used for the end condition. The result of operator* on an end
of stream is not defined. For any other iterator value a const T&
is returned. The result of operator*-> on an end of stream is not
defined. For any other iterator value a const T* is returned. It
is impossible to store things into istream iterators. The main
peculiarity of the istream iterators is the fact that ++ operators
are not equality preserving, that is, i == j does not guarantee at
all that ++i == ++j. Every time ++ is used a new value is read.
2 The practical consequence of this fact is that istream iterators
can be used only for one*-pass algorithms, which actually makes
perfect sense, since for multi-pass algorithms it is always more
appropriate to use in*-memory data structures.
3 Two end*-of*-stream iterators are always equal. An end*-of*-stream
iterator is not equal to a non-*end*-of-*stream iterator. Two non*-
end*-of-*stream iterators are equal when they are constructed from
the same stream.
-Mike