title: Iterators - Overloading functions for vector::iterator and array::iterator
body: <p>I'm trying to overload a certain function so only 
  iterators of contiguous containers 
  (which are std::vector::iterator ,std::array::iterator ,and built-in arrays iterators == raw pointers) can be a valid argument. </p>
  
  <p>for some reason my functions fail to compile for vector and std::array :</p>
  
  <p>functions:</p>
  
  <pre><code>template &lt;class T,size_t N&gt;
  void catchIterator(typename std::array&lt;T, N&gt;::iterator it) {
      //do somthing
  }
  
  template &lt;class T&gt;
  void catchIterator(typename std::vector&lt;T&gt;::iterator it) {
      //do somthing
  }
  </code></pre>
  
  <p>example of use : </p>
  
  <pre><code>std::array&lt;int, 10&gt; arr;
  auto it = arr.begin();
  catchIterator(it);
  
  std::vector&lt;int&gt; vec;
  auto it0 = vec.begin();
  catchIterator(it0);
  </code></pre>
  
  <p>Errors :</p>
  
  <pre><code>Error (active)      no instance of overloaded function "catchIterator" matches the argument list
  Error (active)      no instance of overloaded function "catchIterator" matches the argument list    
  Error   C2783   'void catchIterator(std::array&lt;_Ty,_Size&gt;::iterator)': could not deduce template argument for 'T'   
  
  Error   C2783   'void catchIterator(std::array&lt;_Ty,_Size&gt;::iterator)': could not deduce template argument for 'N'
  
  Error   C2672   'catchIterator': no matching overloaded function found  
  </code></pre>
  
  <p>I'm using VC++ with Visual studio 2015 RTM.</p>
  
  <p>The errors are pretty self-explanatory, but I wonder if the
  compiler couldn't really deduce T and N from it and it0, after
  all, it is part of it/it0 type..</p>
  
  <p>how can make it work?</p>
  
  <p><strong>Edit:</strong><br/>
  I'll go with @ForEveR suggestion and pass the container+iterator/index as arguments instead. 
  thanks!</p>