title: C++ template std::vector::iterator error
body: <p>In C++, I am trying to get a <code>std::vector::iterator</code> for my templated class. However, when I compile it, I get the errors: <code>error C2146: syntax error : missing ';' before identifier 'iterator'</code>, <code>error C4430: missing type specifier - int assumed. Note: C++ does not support default-int</code>. I also get the warning: <code>warning C4346: 'std::vector&lt;T&gt;::iterator' : dependent name is not a type</code>:</p>
  
  <pre><code>#include &lt;vector&gt;
  template&lt;class T&gt; class v1{
      typedef std::vector&lt;T&gt;::iterator iterator; // Error here
  };
  class v2{
      typedef std::vector&lt;int&gt;::iterator iterator; // (This works)
  };
  </code></pre>
  
  <p>I have even tried</p>
  
  <pre><code>template&lt;typename T&gt; class v1{
      typedef std::vector&lt;T&gt;::iterator iterator;
  };
  </code></pre>
  
  <p>And</p>
  
  <pre><code>template&lt;typename T = int&gt; class v1{
      typedef std::vector&lt;T&gt;::iterator iterator;
  };
  </code></pre>