title: Replace templated function call by another "virtual" function call
body: <p>I have a strange C++ question.</p>
  
  <p>If I have the following code:</p>
  
  <pre><code>template&lt;int p1, int p2&gt; class A {
      // SOME STUFF
  };
  
  template&lt;int N&gt; class B {
      // SOME STUFF
      template&lt;int p1, int p2&gt; A&lt;p1,p2&gt; func() {
         A&lt;p1,p2&gt; a(something);
         return a;
  };
  </code></pre>
  
  <p>Now in the main, I want to access func():</p>
  
  <pre><code>int main(void) {
      B&lt;12&gt; b;
      b.func&lt;6,2&gt;();
  }
  </code></pre>
  
  <p>And for some reason, I would like the exact same behaviour with the following code:</p>
  
  <pre><code>int main(void) {
      B&lt;12&gt; b;
      b(6,2);
  }
  </code></pre>
  
  <p>Of course, it is impossible in theory because the template values p1 and p2 have to be resolved at compile time and so they can't be taken as a function parameter. So it is useless to try to overload "operator ()" in class B.</p>
  
  <p>However, isn't there a way to have like an alias, meaning that in my code, the line:</p>
  
  <pre><code>b(x,y);
  </code></pre>
  
  <p>is just replaced by:</p>
  
  <pre><code>b.func&lt;x,y&gt;;
  </code></pre>
  
  <p>before the compilation tries to resolve the templates ? Like a kind of macro which would be specific to class B ?</p>
  
  <p>Thank you in advance to your answers,</p>
  
  <p>Benjamin.</p>