title: Unnamed loop variable in range-based for loop?
body: <p>Is there any way to not "use" the loop variable in a range-based for loop, but also avoid compiler warnings about it being unused?</p>
  
  <p>For context, I'm trying to do something like the following. I have "treat warnings as errors" enabled, and I'd rather not do a hack like forcing the variable to be "used" by pointlessly mentioning it somewhere.</p>
  
  <pre><code>size_t getSize(const std::forward_list &amp;list)
  {
    size_t count = 0;
    for (auto &amp; : list) // compile error, but if i do "auto &amp;i" here, MSVC
                        // complains (reasonably) that i is unused
    {
      ++count;
    }
    return count;
  }
  </code></pre>
  
  <p>I know there are other ways to do this, but let's say for argument's sake that I need to use a range-based for loop.</p>