diff options
author | Idan Horowitz <idan.horowitz@gmail.com> | 2021-09-08 03:20:30 +0300 |
---|---|---|
committer | Idan Horowitz <idan.horowitz@gmail.com> | 2021-09-08 19:17:07 +0300 |
commit | 0279fb4dd37759699c5dc6b570166183a77302e0 (patch) | |
tree | 19c3d194aba8d7e0e297575898723e6e8e072fe0 /AK | |
parent | cb9720baabf9bed1f501556cf6fbce88cd657514 (diff) | |
download | serenity-0279fb4dd37759699c5dc6b570166183a77302e0.zip |
AK: Add key getter to IntrusiveRedBlackTreeNode
Diffstat (limited to 'AK')
-rw-r--r-- | AK/IntrusiveRedBlackTree.h | 7 |
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__ |