title: Index of minimum element in a std::list
body: <p>If I have a <code>std::vector&lt;int&gt;</code>, I can obtain the index of the minimum element by subtracting two iterators:</p>
  
  <pre><code>int min_index = std::min_element(vec.begin(), vec.end()) - vec.begin();
  </code></pre>
  
  <p>However, with containers that don't have random access iterators, for example a <code>std::list&lt;int&gt;</code>, this doesn't work.  Sure, it is possible to do something like</p>
  
  <pre><code>int min_index = std::difference(l.begin(), std::min_element(l.begin(), l.end()));
  </code></pre>
  
  <p>but then I have to iterate twice through the list.</p>
  
  <p>Can I get the index of the element with the minimum value with STL algorithms by only iterating once through the list or do I have to code my own for-loop?</p>