title: STL sort function with comparator
body: <p>This is a syntax question.</p>
  
  <p><a href="http://www.cplusplus.com/reference/algorithm/sort/" rel="nofollow">C++ STL sort function</a>:</p>
  
  <pre><code>template &lt;class RandomAccessIterator, class Compare&gt;
    void sort (RandomAccessIterator first, RandomAccessIterator last, Compare comp);
  </code></pre>
  
  <p>The documentation says that <code>comp</code> can be either a function pointer or an object.</p>
  
  <p>But if you pass a function pointer, what mechanism of C++ allows the function pointer to be used in place of an object i.e. <code>Compare comp</code>?</p>
  
  <p>Why isn't it a compile error?</p>