title: Pass iterator as a function parameter
body: <p>I try to write a function, which will sum the elements of a container. This container can be Vector, List, Queue, etc... That's why I tried templates.</p>
  
  <p>Unfortunately I get this error:</p>
  
  <blockquote>
    <p>'C' is not a template</p>
  </blockquote>
  
  <p>Source:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  
  using namespace std;
  
  template&lt;class C, typename T&gt;
  T sum( C&lt;T&gt;::iterator begin, C&lt;T&gt;::iterator end ) {
      T s = null;
  
      for (C&lt;T&gt;::iterator it = begin; it != end; it++) {
          s += *it;
      }
  
      return s;
  }
  
  int main()
  {
      vector&lt;int&gt; v = {5, 9, 0, 11};
  
      cout &lt;&lt; sum(v.begin(), v.end()) &lt;&lt; endl;
  
      return 0;
  }
  </code></pre>
  
  <p>What do I wrong? How should I fix it?</p>