Request for member X of Y which is of non-class type Z
<p>When trying to compile the following snippet of C++ code (complete source below)</p>

<pre><code>A::A(istream&amp; i) {
    vector&lt;string&gt; words( istream_iterator&lt;int&gt;(i), istream_iterator&lt;int&gt; );
    words.begin();
 }
</code></pre>

<p>I'm getting the error</p>

<pre><code>istream_it.cpp:12: error: request for member ‘begin’ in ‘words’, which is of non-class type 
‘std::vector&lt;int, std::allocator&lt;int&gt; &gt;(
    std::istream_iterator&lt;int, char, std::char_traits&lt;char&gt;, long int&gt;,
    std::istream_iterator&lt;int, char, std::char_traits&lt;char&gt;, long int&gt;)’
</code></pre>

<p>I know this error is usually caused by accidentally declaring a function using the no-parameters operator, as in</p>

<pre><code>string s(); s.size();
</code></pre>

<p>but in this case, I've already stripped all unnecessary code, and still cant see what exactly is going wrong, or what the correct syntax would be.</p>

<p>Full source:</p>

<pre><code>#include &lt;sstream&gt;
#include &lt;vector&gt;
#include &lt;iterator&gt;
#include &lt;string&gt;

using namespace std;

class A {
public:
    A(istream&amp; i) {
        vector&lt;int&gt; words(istream_iterator&lt;int&gt;(i), istream_iterator&lt;int&gt; );
        words.begin();
    }
};


int main(int argc, char** argv)
{
    istringstream iss("1 2 3");
    A a(iss);

    return 0;
}
</code></pre>
