title: Declaring a struct in a template class, undefined for member functions
body: <p>I'm currently trying to implement a sort algorithm in a list template class using node structures private to the list class. I'm using a few private recursive functions which return a pointer to a node type which causes g++ to give me a declaration error. Here's a sample of what I have -</p>
  
  <pre><code>template&lt;class T&gt;
  class SList
  {
  private:
      struct NODE
      {
          T* elem;
          NODE* next;
      } *_head, *_tail;
  
  NODE* sort(NODE* node);
  
  public:
      //other declarations...
  
  }
  
  template&lt;class T&gt;
  NODE* SList&lt;T&gt;::sort(NODE* node) //Error: 'NODE' does not name a type
  {
      //sorting algorithm
  }
  </code></pre>
  
  <p>Is this a limitation of c++ or am I missing something?</p>