title: C++11 range-based for loop: how to ignore value?
body: <p>I have a C++ container and I want to run a loop the same number of times as there are elements in that container.  But I do not care about the values in the container during the loop.  For example:</p>
  
  <pre><code>for (const auto&amp; dummy : input) {
      cout &lt;&lt; '.';
  }
  </code></pre>
  
  <p>The only problem is, <code>dummy</code> is an unused variable and I have instructed the compiler to prohibit those.</p>
  
  <p>Two inelegant solutions I have come up with are to say <code>(void)dummy;</code> in the loop body to silence the compiler, or to use an old-style for loop from 0 to <code>distance(begin(input), end(input))</code>.</p>
  
  <p>I tried omitting the variable name but that failed to compile (no big surprise).</p>
  
  <p>I'm using GCC 4.7.2.</p>