Struct bstree_node

Struct Documentation

struct bstree_node

The base node for all binary search trees.

For all nodes from trees derived from bstree, the node MUST:

(1) Have all the fields present below and have them declared in the same order as the “parent” structs.

(2) Have the same size as the “parent” struct entries.

This is so that I can take the derived class struct, cast it to a bstree/bstree_node, and pass it to a function in the bstree class, and have everything work as desired.

Must be packed and aligned to the same size as dptr_t so that casts from bstree_node.data are safe on all targets.

Public Members

uint8_t key[sizeof(int32_t)]
dptr_t *data
struct bstree_node *left
struct bstree_node *right
struct bstree_node *parent
bool_t red

If the tree is used as a red-black tree, then this field is used to indicate the color of the node. It is undefined for regular BSTs. If red is false then the node is black.

int32_t tmp