title: C++ using function template in class template
body: <pre><code>template &lt;int C&gt; class MyClass;
  
  ...     
  
  
  template &lt;int C&gt;
  double trans(MyClass&lt;C&gt; &amp;a)
  {
      //return some double 
  }
  
  //this is supposed to be function template
  template &lt;int C&gt;
  double func(MyClass&lt;2&gt; &amp;a)
  {
      //return some double
  }
  
  template &lt;int C&gt;
  MyClass&lt;C-1&gt; func(MyClass&lt;C&gt; &amp;a)
  {
      MyClass&lt;C-1&gt; ret;
      return ret;
  }
  
  template &lt;int C&gt;
  double otherFunc(MyClass&lt;C&gt; &amp;a)
  {
       double result;
       if(C == SOME_CONSTANT)
           result = func(a);
       else
           result = trans(func(a));
  
  }
  </code></pre>
  
  <p>What my problem is I want to check template argument C in parameter <code>otherFunc</code> call function template <code>func</code> (return double) instead of member function of class template <code>func</code>(return MyClass). But somehow compiler attempts to <code>func</code> that returns MyClass in</p>
  
  <pre><code>     if(C == SOME_CONSTANT)
           result = func(a);
  </code></pre>
  
  <p>this part so I got compiler error (because double = MyClass is not viable). How should I fix this problem?</p>