I am getting this error in my AVL tree class as described in the title for this part of my code:
template <class T>
std::unique_ptr<AVL<T>::TreeNode> AVL<T>::rightRotate(std::unique_ptr<TreeNode>& y) {
std::unique_ptr<TreeNode> x = std::move(y->left);
std::unique_ptr<TreeNode> T2 = std::move(x->right);
// Perform rotation
x->right = std::move(y);
x->right->left = std::move(T2);
// Update heights
/ x->right->height = std::max(height(x->right->left), height(x->right->right)) + 1;
x->height = std::max(height(x->left), height(x->right)) + 1;
return std::move(x);
}
Initially I thought I could just declare it as it is in the class, i.e. std::unique_ptr<TreeNode> rightRotate(std::unique_ptr<TreeNode>& y);
Anyone know what the problem is? Also, I am not sure if I should post more code of my class, trying to keep it minimal.