title: Get index in C++11 foreach loop
body: <p>Is there a convenient way to get the index of the current container entry in a C++11 foreach loop, like <code>enumerate</code> in python:</p>
  
  <pre><code>for idx, obj in enumerate(container):
      pass
  </code></pre>
  
  <p>I could imagine an iterator that can also return the index or similar.</p>
  
  <p>Of course I could have a counter, but often iterators don't give guarantees of the order they iterate over a container.</p>