title: Can I easily iterate over the values of a map using a range-based for loop?
body: <p>Is it possible to iterate over all of the values in a <code>std::map</code> using just a &quot;foreach&quot;?</p>
  <p>This is my current code:</p>
  <pre><code>std::map&lt;float, MyClass*&gt; foo ;
  
  for (map&lt;float, MyClass*&gt;::iterator i = foo.begin() ; i != foo.end() ; i ++ ) {
      MyClass *j = i-&gt;second ;
      j-&gt;bar() ;
  }
  </code></pre>
  <p>Is there a way I can do the following?</p>
  <pre><code>for (MyClass* i : /*magic here?*/) {
      i-&gt;bar() ;
  }
  </code></pre>