yfast
0.6.1
Loading...
Searching...
No Matches
bst.h
1
#ifndef _YFAST_INTERNAL_BST_H
2
#define _YFAST_INTERNAL_BST_H
3
4
#include <cstddef>
5
6
#include <yfast/utils/aligned.h>
7
8
namespace
yfast::internal {
9
10
template
<
typename
_Key,
typename
T>
11
struct
BSTNodeBase
{
12
typedef
_Key Key;
13
typedef
utils::aligned_ptr<1, T>
Child;
14
15
const
Key key;
16
T* parent;
17
std::uintptr_t _left;
18
std::uintptr_t _right;
19
std::size_t size;
20
21
T* left()
const
{
return
Child(_left).get_ptr(); }
22
T* right()
const
{
return
Child(_right).get_ptr(); }
23
24
void
set_left(T* node) {
25
Child child = _left;
26
child.set_ptr(node);
27
_left = child.value;
28
}
29
void
set_right(T* node) {
30
Child child = _right;
31
child.set_ptr(node);
32
_right = child.value;
33
}
34
};
35
36
}
37
38
#endif
yfast::internal::BSTNodeBase
Definition
bst.h:11
yfast::utils::aligned_ptr
Definition
aligned.h:22
include
yfast
internal
bst.h
Generated by
1.14.0 with
doxygen-awesome
2.3.4