Files
42_INT_11_ft_containers/headers/map_node.hpp
2022-06-29 14:10:17 +02:00

57 lines
633 B
C++

#ifndef MAP_NODE_HPP
# define MAP_NODE_HPP
# include <cstddef> // NULL
namespace ft {
template < typename ValueType >
struct node {
ValueType value;
node *up;
node *left;
node *right;
short height;
node(const ValueType& val)
: value(val)
, up(NULL)
, left(NULL)
, right(NULL)
, height(1)
{}
node* min() {
node* n = this;
while (n->left)
n = n->left;
return n;
}
node* max() {
node* n = this;
while (n->right)
n = n->right;
return n;
}
};
template < typename ValueType >
struct sentinel {
node<ValueType> *child;
sentinel() : child(NULL) {}
};
} // namespace ft
#endif