How to sort C++ map keys with std::greater?
<p>I'm creating a <code>std::map&lt;int, int&gt;</code> in C++ that I'd prefer to have they keys sorted from highest to lowest instead of the default sort order. My research lead me to <a href="http://www.cplusplus.com/reference/functional/greater/" rel="nofollow">std::greater</a> which looked promising but when trying to use it I'm getting a compile error:</p>

<blockquote>
  <p>invalid type argument of unary ‘*’ (have ‘int’)</p>
</blockquote>

<p>My map declaration is:</p>

<pre><code>std::map&lt;int, int, std::greater&lt;int&gt; &gt; numMap;
</code></pre>

<p>And the error is getting thrown from this function:</p>

<pre><code>void Row::addNumber(int num, int pos) {
    numMap.insert(num, pos);
}
</code></pre>

<p>Answers to similar questions such as <a href="http://stackoverflow.com/questions/14828476/confusion-about-using-stdless-and-stdgreater-with-stdsort">this</a> include parenthesis in the declaration, i.e. std::greater<strong>()</strong> - but when I include those I get multiple errors regarding a function returning a function.</p>
