title: How to call a template member function?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1840253/c-template-member-function-of-template-class-called-from-template-function">C++ template member function of template class called from template function</a>  </p>
  </blockquote>
  
  
  
  <pre><code>template&lt;class T1&gt;
  class A 
  {
  public:
      template&lt;class T0&gt;
      void foo() const {}
  };
  
  template&lt;class T0,class T1&gt;
  void bar( const A&lt;T1&gt;&amp; b )
  {
      b.foo&lt;T0&gt;();  // This throws " expected primary-expression before ‘&gt;’ token"
  }
  </code></pre>
  
  <p>I can change it to </p>
  
  <pre><code>b-&gt;A&lt;T1&gt;::template foo&lt;T0&gt;();
  </code></pre>
  
  <p>which compiles fine. However I can also change it to</p>
  
  <pre><code>b.A&lt;T1&gt;::template foo&lt;T0&gt;();
  </code></pre>
  
  <p>which compiles fine too. eh?</p>
  
  <p>How does one correctly call the template member function in the sense of the original code?</p>