title: Understanding a Comparator functor for STL
body: <p>So I have always used comparator functors in STL but never truly understood what returning a true or false meant. I had to run it and adjust the functor all the time. For instance suppose I have the following code</p>
  
  <pre><code>struct functor
  {
      // does returning true place a before b ?
      bool operator()(int a,int b)
      {
          if (a &lt; b)
              return true;
          return false;
      }
  };
  
  int main() 
  {
      std::priority_queue&lt;int, std::vector&lt;int&gt;,functor&gt; q;
      for(int n : {1,8,5,6,3,4,0,9,7,2})
          q.push(n);
  }
  </code></pre>
  
  <p>Could anyone please clarify this </p>
  
  <pre><code>bool operator()(int a,int b)
      {
          if (a &lt; b)
              return true;
          return false;
      }
  </code></pre>
  
  <p>Does returning a true place <code>a</code> before <code>b</code>? I am trying to come up with something like "if a is less than b than return true and true means a will be placed before b" but apparently this is not correct</p>