The binding of an istream_iterator
to an istream
causes one value to be read from the istream
, and stored in the iterator. This is necessary so that dereferening the iterator can give a value. So if you bind 2 istream_iterators
to the same istream
, 2 values will be read.
It's rarely useful to have 2 active istream iterators bound to the same istream.
As an mildly interesting experiment, see what happens if you create both in_iter
and in_iter2
, both bound to cin
, and initialize your vector with in_iter
(or whichever one was created first).