title: How to get the index of an element of a std::vector from the reference to one of it's items?
body: <p>How would you <em>elegantly</em> (and in a modern C++ way) write a function that returns the index of a vector element, taking as argument this vector, and a reference to one of its elements ?</p>
  <p>Exceptions handling would be appreciated.</p>
  <pre><code>#include &lt;vector&gt;
  
  template &lt;class T&gt;
  std::size_t GetIndexFromRef(std::vector&lt;T&gt; &amp;vec, T &amp;item)
  {
  ...
  };
  </code></pre>