title: Good way to template a class/struct combination
body: <p>what's the most effective way to template a class that calls will need to call a templated struct. This is the classic ordered list problem with templating. My entire ordered list works as of now (when I simply change the types manually). However, I am not sure how to go about templating the pair of objects (the struct and the class). </p>
  
  <p>So basically, here is how my code is structured: </p>
  
  <pre><code>struct Node {
      int* data;
      Node* next;
  };
  
  class OList {
      private:
          Node* start;
          int size;
      public:
          a bunch of manipulation functions
  };
  </code></pre>
  
  <p>So, my desire is to simply template the struct, and then accept a parameter that will pass the template into the Node struct type. However, my first attempt, which was to do:</p>
  
  <pre><code>template&lt;class T&gt; 
  </code></pre>
  
  <p>before the Node struct and change all the <code>ints*</code> to <code>T*</code> failed miserably. What might be a better approach in anybody's experience? Can anybody point me in the right direction or give me some good references for template basics? All I can find are specific questions, which doesn't give me a good background to how templating works.</p>
  
  <p>UPDATE: My code works very well at this point. The only thing I still do not understand is how to return pointers of the Node struct in functions. For example, in a function that might be, </p>
  
  <pre><code>template &lt;class T&gt;
  List&lt;T&gt;::Node&lt;T&gt;* List&lt;T&gt;pos(int val); //trying to return a pointer to the node at a specified spot
  </code></pre>
  
  <p>I get the following error: "Non-templated 'Node' used as template. note: use OList::template Node' to indicate that it is a template (???) error: need 'typename' before 'OList::Node' because 'OList is a dependent scope" What is the most efficient way to clear up these errors? Code works perfectly when this one function is commented out.</p>