title: Shorthand for for-loop - syntactic sugar in C++(11)
body: <p>Actually these are two related questions.</p>
  
  <p>I know there is a new syntax in C++11 for range-based <code>for</code> loops of the form:</p>
  
  <pre><code>//v is some container
  for (auto &amp;i: v){
     // Do something with i
  }
  </code></pre>
  
  <p>First question: how can I infer at which iteration I am in this loop? (Say I want to fill a vector with value j at position j).</p>
  
  <p>Second question: I wanted to know if there also is some other way to write a loop of the form</p>
  
  <pre><code>for (int i=0; i&lt;100; i++) { ... }
  </code></pre>
  
  <p>I find this way of writing it a bit cumbersome, and I do this so often and I would love to have a more concise syntax for it.
  Something along the lines:</p>
  
  <pre><code>for(i in [0..99]){ ... }
  </code></pre>
  
  <p>would be great.</p>
  
  <p>For both questions I would like to avoid having to use additional libraries.</p>