summaryrefslogtreecommitdiff
path: root/AK
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2021-09-08 03:20:30 +0300
committerIdan Horowitz <idan.horowitz@gmail.com>2021-09-08 19:17:07 +0300
commit0279fb4dd37759699c5dc6b570166183a77302e0 (patch)
tree19c3d194aba8d7e0e297575898723e6e8e072fe0 /AK
parentcb9720baabf9bed1f501556cf6fbce88cd657514 (diff)
downloadserenity-0279fb4dd37759699c5dc6b570166183a77302e0.zip
AK: Add key getter to IntrusiveRedBlackTreeNode
Diffstat (limited to 'AK')
-rw-r--r--AK/IntrusiveRedBlackTree.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/AK/IntrusiveRedBlackTree.h b/AK/IntrusiveRedBlackTree.h
index 8d372b30e7..6190f6b27a 100644
--- a/AK/IntrusiveRedBlackTree.h
+++ b/AK/IntrusiveRedBlackTree.h
@@ -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__