title: How can I sort an STL map by value?
body: <p>How can I implement STL map sorting by value?</p>
  
  <p>For example, I have a map <code>m</code>:</p>
  
  <pre><code>map&lt;int, int&gt; m;
  m[1] = 10;
  m[2] = 5;
  m[4] = 6;
  m[6] = 1;
  </code></pre>
  
  <p>I'd like to sort that map by <code>m</code>'s value. So, if I print the map, I'd like to get the result as follows:</p>
  
  <pre><code>m[6] = 1
  m[2] = 5
  m[4] = 6
  m[1] = 10
  </code></pre>
  
  <p>How can I sort the map in this way? Is there any way that I can deal with the key and value with sorted values?</p>