title: C++ template and pointers
body: <p>I have a problem with a template and pointers ( I think ). Below is the part of my code:</p>
  
  <pre><code>/* ItemCollection.h */
  
  #ifndef ITEMCOLLECTION_H
  #define ITEMCOLLECTION_H
  
  #include &lt;cstddef&gt;
  
     using namespace std;
  
     template &lt;class T&gt; class ItemCollection
     {
     public:
      // constructor
          //destructor 
  
       void insertItem( const T );
  
     private:
           struct Item
           {
            T price;
            Item* left;               
            Item* right;          
           };
           Item* root;     
           Item* insert( T, Item* );
  
     };
   #endif
  </code></pre>
  
  <p>And the file with function defintion:</p>
  
  <pre><code>/* ItemCollectionTemp.h-member functions defintion */
  
  #include &lt;iostream&gt;
  #include &lt;cstddef&gt;
  
  #include "ItemCollection.h"
  
  template &lt;class T&gt;
     Item* ItemCollection &lt;T&gt;::insert( T p, Item* ptr)
     {
        // function body
     }
  </code></pre>
  
  <p>Here are the errors which are generated by this line of code:</p>
  
  <pre><code>Item* ItemCollection &lt;T&gt;::insert( T p, Item* ptr)
  </code></pre>
  
  <p>Errors:</p>
  
  <p>error C2143: syntax error : missing ';' before '*'</p>
  
  <p>error C4430: missing type specifier - int assumed. Note: C++ does not support default-int</p>
  
  <p>error C2065: 'Type' : undeclared identifier</p>
  
  <p>error C2065: 'Type' : undeclared identifier</p>
  
  <p>error C2146: syntax error : missing ')' before identifier 'p'</p>
  
  <p>error C4430: missing type specifier - int assumed. Note: C++ does not support default-int</p>
  
  <p>error C2470: 'ItemCollection::insert' : looks like a function definition, but there is no parameter list; skipping apparent body</p>
  
  <p>error C2072: 'ItemCollection::insert': initialization of a function</p>
  
  <p>error C2059: syntax error : ')'</p>
  
  <p>Any help is much appreciated.</p>