mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 17:07:46 +00:00
AK: Add key getter to IntrusiveRedBlackTreeNode
This commit is contained in:
parent
cb9720baab
commit
0279fb4dd3
1 changed files with 6 additions and 1 deletions
|
@ -52,7 +52,7 @@ public:
|
||||||
{
|
{
|
||||||
auto& node = value.*member;
|
auto& node = value.*member;
|
||||||
VERIFY(!node.m_in_tree);
|
VERIFY(!node.m_in_tree);
|
||||||
node.key = key;
|
static_cast<typename BaseTree::Node&>(node).key = key;
|
||||||
BaseTree::insert(&node);
|
BaseTree::insert(&node);
|
||||||
if constexpr (!TreeNode::IsRaw)
|
if constexpr (!TreeNode::IsRaw)
|
||||||
node.m_self.reference = &value; // Note: Self-reference ensures that the object will keep a ref to itself when the Container is a smart pointer.
|
node.m_self.reference = &value; // Note: Self-reference ensures that the object will keep a ref to itself when the Container is a smart pointer.
|
||||||
|
@ -176,6 +176,11 @@ public:
|
||||||
return m_in_tree;
|
return m_in_tree;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] K key() const
|
||||||
|
{
|
||||||
|
return BaseRedBlackTree<K>::Node::key;
|
||||||
|
}
|
||||||
|
|
||||||
static constexpr bool IsRaw = IsPointer<Container>;
|
static constexpr bool IsRaw = IsPointer<Container>;
|
||||||
|
|
||||||
#ifndef __clang__
|
#ifndef __clang__
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue