Thanks. I'm now trying to tackle errors I get when I try to use the function.
Error:
1 2
BST.h:147:9: error: no matching function for call to ‘BinarySearchTree<int>::insert(constint&, BinarySearchTree<int>*)’
BST.h:133:6: note: candidate is: void BinarySearchTree<Type>::insert(const Type&, BinarySearchTree<Type>*&) [with Type = int]
But, item is of type Type and tree->getRight() is of type BinarySearchTree<Type>. I don't understand.
I think you have a design flaw. If insert can only be called with a valid pointer, why are you checking for the pointer to be null? If you intend it to be called externally, why is it being called from the same instance that uses it?
In most linked list implementations I've seen, you don't assign to the node you have been passed. You assign to a pointer within the node you have been passed.
I led you though a wild goose chase in the hopes you would notice your mistake - now I am telling you: you need to redesign your code some.