How to load stream cin into vector
<p>I want to load a vector with integers from cin. The following code works:</p>

<pre><code>std::istream_iterator&lt; int &gt; iterBegin( std::cin ), iterEnd;
vector&lt; int &gt; v( iterBegin, iterEnd );
</code></pre>

<p>However, when I try to write it more succinctly, it fails:</p>

<pre><code>vector&lt; int &gt; v(std::istream_iterator&lt; int &gt;(std::cin), 
                std::istream_iterator&lt; int &gt;() );
</code></pre>

<p>Any ideas?</p>