Skip to content

Commit

Permalink
Add docstring for get_parent_id_unsafe().
Browse files Browse the repository at this point in the history
  • Loading branch information
SharafMohamed committed Dec 5, 2024
1 parent 748dfc5 commit 8abf35a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/log_surgeon/finite_automata/PrefixTree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ class PrefixTree {

[[nodiscard]] auto is_root() const -> bool { return false == m_parent_id.has_value(); }

/**
* Gets the parent ID without checking if it's `std::nullopt`.
* NOTE: This method should only be used if the caller has checked the node is not the root.
* @return The ID of the parent node in the prefix tree.
*/
[[nodiscard]] auto get_parent_id_unsafe() const -> id_t {
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
return m_parent_id.value();
Expand Down

0 comments on commit 8abf35a

Please sign in to comment.