title: Should I use functions or stateless functors?
body: <p>These 2 piece of code do same thing. And it will be used in sort function as you can see.
  Which is better? I usually write latter one. But I saw some coders do it like former one.</p>
  
  <pre><code>struct val_lessthan : binary_function&lt;pair&lt;string,int&gt;, pair&lt;string, int&gt;, bool&gt;
  {
      bool operator() (const pair&lt;string,int&gt;&amp; x, const pair&lt;string,int&gt;&amp; y) const
      {
          return x.second &lt; y.second;
      }
  } val_lt;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>bool val_lt(const pair&lt;string,int&gt;&amp; x, const pair&lt;string,int&gt;&amp; y) 
  {
      return x.second &lt; y.second;
  }
  </code></pre>
  
  <p>Will use it like:</p>
  
  <pre><code>std::sort(wordvector.begin(), wordvector.end(), val_lt);
  </code></pre>