title: Sorting map by size
body: <p>I have similar map:</p>
  
  <pre><code>map&lt;int, map&lt;int, map&lt;int, int&gt; &gt; &gt; myMap;
  
  order-num | id | order-num-of-relation | relation-id
  -----------------------------------------------------
      0     | 1  | 0                     | 2
  -----------------------------------------------------
      1     | 2  | 0                     | 1
  -----------------------------------------------------
            |    | 1                     | 3
  -----------------------------------------------------
      2     | 3  | 0                     | 2
  -----------------------------------------------------
  </code></pre>
  
  <p>1(1), 2(2), 3(1)</p>
  
  <p>and i need to sort (change the "order-num") this map by size of the last map (order-num-of-relation | relation-id).</p>
  
  <p>I just need to do this:</p>
  
  <pre><code>order-num | id | order-num-of-relation | relation-id
  -----------------------------------------------------
      0     | 1  | 0                     | 2
  -----------------------------------------------------
      1     | 3  | 0                     | 2
  -----------------------------------------------------
      2     | 2  | 0                     | 1
  -----------------------------------------------------
            |    | 1                     | 3
  -----------------------------------------------------
  </code></pre>
  
  <p>1(1), 3(1), 2(2)</p>
  
  <p>can i use the "sort" function and pass here own sorting function (where i can checking size and returing true/false), or do i have to write explicite sorting algorithm?</p>