title: Using a pointer to a function as a template parameter
body: <p>(C++) I've got a number of Entry classes, and got BaseProcessor interface which incapsulates Entry processing logic. (see code below)</p>
  
  <p>The Entry doesn't provide operator&lt;(). The BaseProcessor provides a pointer to less(Entry, Entry) function which is specific for particular BaseProcessor implementation.</p>
  
  <p>I can use the function pointer to compare Entry instances in my program. However I need to create std::set (or std::map, or something else that uses less() ) for Entry class. I've tried to use std::binary_function derived class to pass it to std::set, but it looks like I can't pass a function pointer value to a template.</p>
  
  <p>How can I do this? Is it possible with C++03?</p>
  
  <p>Thanks.</p>
  
  <pre><code>struct Entry
  {
    // ...
  private: 
    bool operator&lt; (const Entry &amp;) const; // Should be defined by BaseProcessor.
  };
  
  typedef bool (*LessFunc)(const Entry &amp;, const Entry &amp;);
  
  class BaseProcessor
  {
  public:
    // ...
    virtual LessFunc getLessFunc () const = 0;
  };
  
  // ...
  
  BaseProcessor *processor = getProcessor();
  LessFunc lessfunc = processor-&gt;getLessFunc();
  
  Entry e1;
  Entry e2;
  bool isLess = lessfunc(e1, e2);  // OK
  
  typedef std::set&lt;Entry, ???&gt; EntrySetImpl; // how to use lessfunc here?
  EntrySetImpl entries;   
  </code></pre>