title: Function pointer to templated function
body: <p>I have two templated function signatures. Here T can be either int or double.</p>
  
  <pre><code>template &lt;typename T&gt;
  Box&lt;T&gt; f2p(Box&lt;T&gt; const&amp; box, Point&lt;T&gt; const&amp; pt, Orientation o)
  {
   ...
  }
  
  template &lt;typename T&gt;
  Box&lt;T&gt; p2f(Box&lt;T&gt; const&amp; box, Point&lt;T&gt; const&amp; pt, Orientation o)
  {
   ...
  }
  </code></pre>
  
  <p>Now depending upon direction, I want to call either f2p or p2f. I want to create a function pointer that points to either f2p or p2f. How do I create a function pointer to a templated function? I want to achieve the following effect:</p>
  
  <pre><code>typename &lt;template T&gt;
  Box&lt;T&gt; do_transformation(Box&lt;T&gt; const&amp; box, ..., int dir = 0)
  {
     function pointer p = dir ? pointer to f2p : pointer to p2f
  
     return p&lt;T&gt;(box);
  }
  </code></pre>
  
  <p>I try something like this but I get compile errors:</p>
  
  <pre><code>Box&lt;T&gt; (*p)(Box&lt;T&gt;, Point&lt;T&gt;, Orientation) = dir ? fc2p&lt;T&gt; : p2fc&lt;T&gt;
  </code></pre>