-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnode.hpp
More file actions
79 lines (68 loc) · 1.85 KB
/
node.hpp
File metadata and controls
79 lines (68 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#ifndef NODE_HPP
# define NODE_HPP
# include <cstddef>
# include <limits>
# include <sstream>
# include <typeinfo>
# include <iostream>
namespace ft
{
template <typename T>
struct BST_Node
{
public :
typedef T value_type;
value_type value;
BST_Node* parent;
BST_Node* left;
BST_Node* right;
BST_Node ()
:
value(),
parent(NULL),
left(NULL),
right(NULL)
{}
BST_Node (BST_Node* parent = NULL,
BST_Node* left = NULL, BST_Node* right = NULL)
:
value(),
parent(parent),
left(left),
right(right)
{}
BST_Node (const value_type& val, BST_Node* parent = NULL,
BST_Node* left = NULL, BST_Node* right = NULL)
:
value(val),
parent(parent),
left(left),
right(right)
{}
BST_Node (const BST_Node& nd)
:
value(nd.value),
parent(nd.parent),
left(nd.left),
right(nd.right)
{}
virtual ~BST_Node() {}
BST_Node &operator=(const BST_Node& nd)
{
if (nd == *this)
return (*this);
this->value = nd.value;
this->parent = nd.parent;
this->left = nd.left;
this->right = nd.right;
return (*this);
}
bool operator==(const BST_Node& nd)
{
if (value == nd.value)
return (true);
return (false);
}
};
}
# endif