63 using pos_type = std::uint32_t;
64 using offset_type = std::uint32_t;
66 static constexpr pos_type
const TYPE_BIT =
67 pos_type(1) << (std::numeric_limits<pos_type>::digits - 1);
68 static constexpr pos_type
const NULL_POS = std::numeric_limits<pos_type>::max();
69 static constexpr pos_type
const PROCESSING_POS = NULL_POS - 1;
70 static constexpr pos_type
const INVALID_POS = NULL_POS - 2;
71 static constexpr pos_type
const MAX_VALID_POS = INVALID_POS - 1;
73 pos_type pos{NULL_POS};
74 offset_type offset{0};
78 constexpr TreeIndex(pos_type pos, offset_type offset) noexcept
79 : pos(pos), offset(offset)
85 std::swap(lhs.pos, rhs.pos);
86 std::swap(lhs.offset, rhs.offset);
89 constexpr bool operator==(
TreeIndex rhs)
const
91 return pos == rhs.pos && offset == rhs.offset;
94 constexpr bool operator!=(
TreeIndex rhs)
const {
return !(operator==(rhs)); }
96 [[nodiscard]]
constexpr TreeIndex sibling(offset_type offset)
const
101 [[nodiscard]]
constexpr bool valid()
const {
return MAX_VALID_POS >= pos; }