We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9d2128a commit 898d86eCopy full SHA for 898d86e
2 files changed
modules/Container/Tree.mpp
@@ -39,15 +39,15 @@ export namespace CppUtils::Container
39
for (auto& node : nodes)
40
if (key == node.value)
41
return node;
42
- return nodes.emplace_back(Node<T>{key});
+ return nodes.emplace_back(key);
43
}
44
45
[[nodiscard]] inline constexpr auto operator[](const ValueType& key) const -> const Node<T>&
46
{
47
- const auto value = find(key);
48
- if (value == std::cend(nodes))
+ if (const auto value = find(key); value == std::cend(nodes)) [[unlikely]]
49
throw std::out_of_range{"The Node does not contain the requested child."};
50
- return *value;
+ else
+ return *value;
51
52
53
[[nodiscard]] inline constexpr auto getNodesWithValue(const ValueType& filterValue) const
0 commit comments