title: Get index of element in C++ map
body: <p>I have a <code>std::map</code> called <code>myMap</code> in my C++ application, and I want to get an element using either <code>myMap.find(key)</code> or <code>myMap[key]</code>. However, I would also like to get the index of that element in the map.</p>
  
  <pre><code>std::map&lt;string, int&gt; myMap;
  // Populate myMap with a bunch of items...
  myElement = myMap["myKey"];
  // Now I need to get the index of myElement in myMap
  </code></pre>
  
  <p>Is there a clean way to do that?</p>
  
  <p>Thank you.</p>