13 std::unique_ptr<Node<T>>
left;
58 right = std::make_unique<Node<T>>(ptn->right,
this);
61 left = std::make_unique<Node<T>>(ptn->left,
this);
80 std::cout <<
"Node has value: " <<
data.second <<
"\n";
82 std::cout <<
"Left child has value: " <<
left->data.second <<
"\n";
84 std::cout <<
"Right child has value: " <<
right->data.second <<
"\n";
86 std::cout <<
"Parent is Node with value: " <<
parent->data.second <<
"\n";
Node()
Default constructor.
Definition: Node.h:30
Node(const T &_data, Node< T > *_parent) noexcept
Copy constructor.
Definition: Node.h:42
std::unique_ptr< Node< T > > right
Unique pointer to the right child.
Definition: Node.h:16
Node< T > * parent
Raw pointer to the parent Node.
Definition: Node.h:19
void print()
Move constructor.
Definition: Node.h:79
Node(const T &_data)
Custom constructor.
Definition: Node.h:25
T data
Data to be stored in the Node.
Definition: Node.h:11
std::unique_ptr< Node< T > > left
Unique pointer to the left child.
Definition: Node.h:13
Node(const std::unique_ptr< Node< T >> &ptn, Node< T > *_parent)
Helper recursive function that, starting from a Node and its parent, copy all the tree recursively.
Definition: Node.h:55
~Node()=default
Default-generated destructor.