mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 18:02:05 -05: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;
|
||||
VERIFY(!node.m_in_tree);
|
||||
node.key = key;
|
||||
static_cast<typename BaseTree::Node&>(node).key = key;
|
||||
BaseTree::insert(&node);
|
||||
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.
|
||||
|
@ -176,6 +176,11 @@ public:
|
|||
return m_in_tree;
|
||||
}
|
||||
|
||||
[[nodiscard]] K key() const
|
||||
{
|
||||
return BaseRedBlackTree<K>::Node::key;
|
||||
}
|
||||
|
||||
static constexpr bool IsRaw = IsPointer<Container>;
|
||||
|
||||
#ifndef __clang__
|
||||
|
|
Loading…
Add table
Reference in a new issue