title: Binary-Tree in Template
body: <p>so i want to make a code, that creates a binary tree, that holds data, for example ints like 1,6,2,10,8 and on pop i get the biggest number, and after that it gets deleted from the tree, and on push i can insert a new  element. And this should be in a template so i can easy change the data type i want to hold in the tree. Now i got the tree so  far, without template it is working fine thought, i can add items, and i can print them, but when i try to put it in a template, i get the following error: <strong>use of class template requires template argument list</strong> . What could be the problem? Maybe i am doing it totally wrong. Any suggestions are welcome.</p>
  
  <p>I got the following code so far: </p>
  
  <pre><code>#include &lt;iostream&gt;
  
  
  using namespace std;
  
  
  template&lt;class T&gt;
  class BinaryTree
  {
  struct Node
      {
          T data;
          Node* lChildptr;
          Node* rChildptr;
  
          Node(T dataNew)
          {
              data = dataNew;
              lChildptr = NULL;
              rChildptr = NULL;
          }
      };
  private:
      Node* root; 
  
          void Insert(T newData, Node* &amp;theRoot)
          {
              if(theRoot == NULL)
              {
                  theRoot = new Node(newData);
                  return;
              }
  
              if(newData &lt; theRoot-&gt;data)
                  Insert(newData, theRoot-&gt;lChildptr);
              else
                  Insert(newData, theRoot-&gt;rChildptr);;
          }
  
          void PrintTree(Node* theRoot)
          {
              if(theRoot != NULL)
              {
                  PrintTree(theRoot-&gt;lChildptr);
                  cout&lt;&lt; theRoot-&gt;data&lt;&lt;" ";;
                  PrintTree(theRoot-&gt;rChildptr);
              }
          }
  
      public:
          BinaryTree()
          {
              root = NULL;
          }
  
          void AddItem(T newData)
          {
              Insert(newData, root);
          }
  
          void PrintTree()
          {
              PrintTree(root);
          }
      };
  
      int main()
      {
          BinaryTree&lt;int&gt; *myBT = new BinaryTree();
          myBT-&gt;AddItem(1);
          myBT-&gt;AddItem(7);
          myBT-&gt;AddItem(1);
          myBT-&gt;AddItem(10);
          myBT-&gt;AddItem(4);
          myBT-&gt;PrintTree();
      }
  </code></pre>