why does creating a local type vector fail
<pre><code>#include &lt;iostream&gt;
#include &lt;vector&gt;

int main()
{
    class Int {
        public:
            Int(int _i) : i(i) {}
        private:
            int i;
    };

    std::vector&lt;Int&gt; VI;
}
</code></pre>

<p>I try to compile the above code and got the following error message:</p>

<pre><code>foo.cc: In function 'int main()':
foo.cc:13: error: 'main()::Int' uses local type 'main()::Int'
foo.cc:13: error:   trying to instantiate 'template&lt;class _Alloc&gt; class std::allocator'
foo.cc:13: error: template argument 2 is invalid
foo.cc:13: error: invalid type in declaration before ';' token
</code></pre>

<p>Could anyone of you tell me why I can't do things like this in C++? Thanks in advance.</p>
