title: Sorting a vector of objects in C++
body: <pre><code>struct Keyword
  {
      std::string keyword;
      int numUses;
  };  
  
  bool sortingVector(const Keyword&amp; key1, const Keyword&amp; key2)
  {
      return key1.numUses &lt; key2.numUses;
  }
  
  sort(topKeywords.begin(), topKeywords.end(), sortingVector);
  
  
  
  : no matching function for call to 'sort(std::vector&lt;Keyword&gt;::iterator, std::vector&lt;Keyword&gt;::iterator, &lt;unresolved overloaded function type&gt;)'
          c:\mingw\bin\../lib/gcc/mingw32/4.5.0/include/c++/bits/stl_algo.h:5236:18: note: candidate is: void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator&lt;Keyword*, std::vector&lt;Keyword&gt; &gt;, _Compare = bool (NewsAggregatorImpl::*)(const Keyword&amp;, const Keyword&amp;)]
  </code></pre>
  
  <p>Why isn't this correct, my compiler gives me that error.<br>
  And i want my function to be global.<br>
  Thank you.</p>