I tried to implement BST but it std::nullptrshows me an error:
error: expected unqualified-id to 'nullptr
#include <iostream>
#include <memory>
template <typename T>
class BinTreeNode {
public:
BinTreeNode(T key): data {key} {
left = std::nullptr;
right = std::nullptr;
}
~BinTreeNode() {}
T data;
BinTreeNode<T>* left;
BinTreeNode<T>* right;
};
template <typename T>
class BinTree {
public:
BinTree(){
root = std::nullptr;
}
~BinTree() {}
BinTreeNode<T>* root;
};
int main(){
BinTree<int> tree;
}
I tried to find it on Google, but nothing significant was connected with std::nullptr
source
share