title: Function pointer to class template member
body: <p>I've got this class:</p>
  
  <pre><code>template &lt;class T&gt;
  class list
  {
      ...
      bool moreThan(T x, T y);
      bool lessThan(T x, T y);
      ...
  };
  </code></pre>
  
  <p>I need a function pointer to change the behavior of my class, and switch between using <code>bool moreThan(T, T)</code> or <code>bool lessThan(T, T)</code>.
  So I'm currently using:</p>
  
  <pre><code>bool (list&lt;int&gt;::*foo)(int x, int y);
  foo = &amp;list&lt;int&gt;::lessThan;
  </code></pre>
  
  <p>and to use it:</p>
  
  <pre><code>(this-&gt;*foo)(x, y);
  </code></pre>
  
  <p>but I would like to have a flexible function pointer, so that I can use it with whichever <code>T</code> I need, not just <code>int</code>. So is there a way to create a function pointer to a class template member? Something like:</p>
  
  <pre><code>template &lt;class T&gt;
  bool (list&lt;T&gt;::*foo)(T x, T y); //this doesn't work
  </code></pre>