Skip to content

Commit

Permalink
AK: Mark RedBlackTree functions as [[nodiscard]]
Browse files Browse the repository at this point in the history
  • Loading branch information
bgianfo authored and awesomekling committed Jul 17, 2021
1 parent af65c4d commit 6059d69
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion AK/IntrusiveRedBlackTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class IntrusiveRedBlackTree final : public BaseRedBlackTree<K> {
}
[[nodiscard]] bool is_end() const { return !m_node; }
[[nodiscard]] bool is_begin() const { return !m_prev; }
[[nodiscard]] auto key() const { return m_node->key; }

private:
friend class IntrusiveRedBlackTree;
Expand Down Expand Up @@ -159,7 +160,7 @@ class IntrusiveRedBlackTreeNode : public BaseRedBlackTree<K>::Node {
VERIFY(!is_in_tree());
}

bool is_in_tree()
[[nodiscard]] bool is_in_tree() const
{
return m_in_tree;
}
Expand Down
2 changes: 1 addition & 1 deletion AK/RedBlackTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ class RedBlackTreeIterator {
[[nodiscard]] bool is_end() const { return !m_node; }
[[nodiscard]] bool is_begin() const { return !m_prev; }

auto key() const { return m_node->key; }
[[nodiscard]] auto key() const { return m_node->key; }

private:
friend TreeType;
Expand Down

0 comments on commit 6059d69

Please sign in to comment.