title: C++ Nested Template Class Method Issue
body: <p>I'm having a problem with the method declaration for a nested class template.
  I have something like this:</p>
  
  <pre><code>template &lt;typename T&gt;
  class HashTrie
  {
      template &lt;typename Y&gt;
      class Entry
      { // members and methods here
      };
  
      template &lt;typename U&gt;
      class Node
      { // members and methods here
      };
  
       // members and methods here
  }
  </code></pre>
  
  <p>The following seems to work without a problem:</p>
  
  <pre><code>template &lt;typename T&gt;
  template &lt;typename Y&gt;
  HashTrie&lt;T&gt;::Entry&lt;Y&gt; HashTrie&lt;T&gt;::Entry&lt;Y&gt;::someMethod() {
      //...
  }
  </code></pre>
  
  <p>However, this does not:</p>
  
  <pre><code>template &lt;typename T&gt;
  template &lt;typename U&gt;
  std::map&lt;char, HashTrie&lt;T&gt;::Node&lt;U&gt; &gt; HashTrie&lt;T&gt;::Node&lt;U&gt;::anotherMethod() {
  // ...
  }
  </code></pre>
  
  <p>I get the following error on GCC</p>
  
  <pre><code>./HashTrie.h:389: error: type/value mismatch at argument 2 in template parameter list for ‘template&lt;class _Key, class _Tp, class _Compare, class _Alloc&gt; class std::map’
  ./HashTrie.h:389: error:   expected a type, got ‘(HashTrie::Node &lt; &lt;expression error&gt;)’
  ./HashTrie.h:389: error: template argument 4 is invalid
  ./HashTrie.h:389: error: expected unqualified-id before ‘&gt;’ token
  </code></pre>
  
  <p>I tried adding a typename, but that doesn't seem to help</p>
  
  <pre><code>template &lt;typename T&gt;
  template &lt;typename U&gt;
  std::map&lt;char, typename HashTrie&lt;T&gt;::Node&lt;U&gt; &gt; HashTrie&lt;T&gt;::Node&lt;U&gt;::anotherMethod() {
  // ...
  }
  </code></pre>
  
  <p>results in...</p>
  
  <pre><code>./HashTrie.h:389: error: template argument 2 is invalid
  ./HashTrie.h:389: error: template argument 4 is invalid
  ./HashTrie.h:389: error: expected unqualified-id before ‘&gt;’ token
  </code></pre>
  
  <p>icpc says:</p>
  
  <pre><code>./HashTrie.h(389): error: template parameter "HashTrie&lt;T&gt;::Node [with T=T]" may not have a template argument list
      std::map&lt;char, typename HashTrie&lt;T&gt;::Node&lt;U&gt; &gt; HashTrie&lt;T&gt;::Node&lt;U&gt;::newNodeMap() {
  </code></pre>
  
  <p>I'm not really sure what to do here, and had a hard time finding any similar problems across the web. Any help would be appreciated.</p>