title: Convert vector iterator to pointer
body: <p>Is there any way to convert a <code>vector::iterator</code> into a pointer without having access to the vector itself? This works only if the <code>vector</code> is available:</p>
  
  <pre><code>typedef vector&lt;int&gt; V;
  int* to_pointer1( V&amp; v, V::iterator t )
  {
      return v.data() + (t-v.begin() );
  }
  </code></pre>
  
  <p>But how can this be done without having the <code>vector</code> around?  This wouldn't work:</p>
  
  <pre><code>int* to_pointer2( V::iterator t )
  {
      // the obvious approach doesn't work for the end iterator
      return &amp;*t;
  }
  </code></pre>
  
  <p>In fact I would have expected this to be a very basic and popular question but for some reason I couldn't find it.</p>