title: syntax for declaring a function template
body: <p>I'm trying to create a template function that takes a vector argument of any type T (primitive for now) and prints out its contents:</p>
  
  <pre><code>template&lt;class T&gt;
  void displayContents(const vector&lt;T&gt;&amp; data)
  {
      vector&lt;T&gt;::const_iterator i;
      i=data.begin();
  
      for( ; i!=data.end(); i++){
          cout&lt;&lt;*i&lt;endl;
      }
  }
  </code></pre>
  
  <p>The error message is:</p>
  
  <blockquote>
    <p>In function 'void displayContents(const std::vector >&amp;)':
    error: expected ';' before 'i' |
    error:'i' was not declared in this scope
    === Build finished: 2 errors, 0 warnings ===</p>
  </blockquote>
  
  <p>Am I overlooking a syntax error?</p>