title: How to use range-based for() loop with std::map?
body: <p>The common example for C++11 range-based for() loops is always something simple like this:</p>
  
  <pre><code>std::vector&lt;int&gt; numbers = { 1, 2, 3, 4, 5, 6, 7 };
  for ( auto xyz : numbers )
  {
       std::cout &lt;&lt; xyz &lt;&lt; std::endl;
  }
  </code></pre>
  
  <p>In which case <code>xyz</code> is an <code>int</code>.  But, what happens when we have something like a map?  What is the type of the variable in this example:</p>
  
  <pre><code>std::map&lt; foo, bar &gt; testing = { /*...blah...*/ };
  for ( auto abc : testing )
  {
      std::cout &lt;&lt; abc &lt;&lt; std::endl;         // ? should this give a foo? a bar?
      std::cout &lt;&lt; abc-&gt;first &lt;&lt; std::endl;  // ? or is abc an iterator?
  }
  </code></pre>
  
  <p>When the container being traversed is something simple, it looks like range-based for() loops will give us each item, not an iterator.  Which is nice...if it was iterator, first thing we'd always have to do is to dereference it anyway.</p>
  
  <p>But I'm confused as to what to expect when it comes to things like maps and multimaps.</p>
  
  <p>(I'm still on g++ 4.4, while range-based loops are in g++ 4.6+, so I haven't had the chance to try it yet.)</p>