I've look on several other SE posts to see if they are similar to my problem, but far as I can see, they are not.
I am doing a binary search tree as part of an assignment for my class. My add function is throwing an & l-value required error, and I have no idea why.
bool addNodeToNode(T data, NodeInterface<T>** cNode) {
if ((*cNode) == nullptr || cNode == NULL) {
(*cNode) = new Node<T>(data);
return true;
}
int nodeData = (*cNode)->getData();
if (data == (*cNode)->getData()) return false;
//error thrown on the following 2 lines
if (data < nodeData) addNodeToNode(data, &(*cNode)->getLeftChild());
if (data > nodeData) addNodeToNode(data, &(*cNode)->getRightChild());
return true;
};
From what I understand, this error is thrown when the left or right value cannot be assigned to the other value, but I am not assigning anything. What really confuses me is that the == operator does not throw an error.
If it is relavent information, getData(), getRightChild() and getLeftChild() return constant pointers.