title: templates and returning a node*
body: <p>I am making a BST class with template types for the key, data and a comparison function. I have a function that creates new nodes and returns a pointer to other functions. The problem is, the return type is not valid while using templates. I have created trees previously without templates and returning a type node* wasn't an issue. I'm not sure of what is happening behind the scenes to make the template version not work. 
  The errors I'm getting include:</p>
  
  <p>unrecognizable template declaration/definition</p>
  
  <p>syntax error: missing ';' before '*'</p>
  
  <p>missing type specifier - int assumed. Note: C++ does not support default-int </p>
  
  <p>My class template, node struct and node create function are below:</p>
  
  <pre><code>template &lt;typename KEY, typename VALUE, bool (*COMPARE)(KEY, KEY )&gt;
  class BSTROOT {
  
  private:
      struct Node {
          KEY key;
          VALUE value;
          Node *left = nullptr;
          Node *right = nullptr;
      };
      Node* createNode(const KEY&amp; key, const VALUE&amp; value);
  
  
  
  template &lt;typename KEY, typename VALUE, bool(*COMPARE)(KEY, KEY)&gt; Node* BSTROOT&lt;KEY, VALUE, COMPARE&gt;::createNode(const KEY&amp; key, const VALUE&amp; value) {
      Node *temp = new Node;
      temp-&gt;key = key;
      temp-&gt;value = value;
      return temp;
  }
  </code></pre>
  
  <p>Any tips or information would be appreciated.</p>