mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-26 20:55:35 +03:00
AK: Add key getter to IntrusiveRedBlackTreeNode
This commit is contained in:
parent
cb9720baab
commit
0279fb4dd3
Notes:
sideshowbarker
2024-07-18 04:25:55 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/0279fb4dd37 Pull-request: https://github.com/SerenityOS/serenity/pull/9884 Reviewed-by: https://github.com/alimpfard ✅
@ -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…
Reference in New Issue
Block a user