10 using typename BSTNodeBase<Key, T>::Child;
17 [[nodiscard]]
bool is_left_heavy()
const {
return Child(_left).get_bit(0); }
18 [[nodiscard]]
bool is_right_heavy()
const {
return Child(_right).get_bit(0); }
19 [[nodiscard]]
bool is_balanced()
const {
return !is_left_heavy() && !is_right_heavy(); }
21 void set_left_heavy() {
22 Child left_child = _left;
23 left_child.set_bit(0);
24 _left = left_child.value;
26 Child right_child = _right;
27 right_child.clear_bit(0);
28 _right = right_child.value;
30 void set_right_heavy() {
31 Child left_child = _left;
32 left_child.clear_bit(0);
33 _left = left_child.value;
35 Child right_child = _right;
36 right_child.set_bit(0);
37 _right = right_child.value;
40 Child left_child = _left;
41 left_child.clear_bit(0);
42 _left = left_child.value;
44 Child right_child = _right;
45 right_child.clear_bit(0);
46 _right = right_child.value;