title: std::vector and its iterator as single template typename
body: <p>In order to get an "easier-to-remember" interface to the
  index-generating function std::distance(a,b), I came up 
  with the idea of a better distinction of it's arguments 
  (when used against the base of a vector: vec.begin() )
  by calling a templated function with the vector
  and its iterator, like:</p>
  
  <pre><code>std::vector&lt;MyType&gt; vect;
  std::vector&lt;MyType&gt;::const_iterator iter;
  ...
  ...
  size_t id = vectorindex_of(iter, vect);
  </code></pre>
  
  <p>with the rationale of never confusing the order of
  the arguments ;-)</p>
  
  <p>The explicit formulation of the above idea would
  read sth. like</p>
  
  <pre><code> template &lt;typename T&gt;
   inline 
   size_t vectorindex_of( 
            typename std::vector&lt;T&gt;::const_iterator iter, 
            const std::vector&lt;T&gt;&amp; vect ) {
  
    return std::distance( vect.begin(), iter ); 
   }
  </code></pre>
  
  <p>... which works but looks awkward.</p>
  
  <p>I'd love to have the template mechanism implicitly deduce the types
  like (pseudo-code):</p>
  
  <pre><code> template &lt;typename T&gt;
   inline 
   size_t vectorindex_of(T::const_iterator iter, const T&amp; vect) {
      return std::distance( vect.begin(), iter ); 
   }
  </code></pre>
  
  <p>... which doesn't work. But why?</p>