Skip to content

Commit 898d86e

Browse files
committed
Language/VirtualMachine: New version
1 parent 9d2128a commit 898d86e

2 files changed

Lines changed: 470 additions & 291 deletions

File tree

modules/Container/Tree.mpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ export namespace CppUtils::Container
3939
for (auto& node : nodes)
4040
if (key == node.value)
4141
return node;
42-
return nodes.emplace_back(Node<T>{key});
42+
return nodes.emplace_back(key);
4343
}
4444

4545
[[nodiscard]] inline constexpr auto operator[](const ValueType& key) const -> const Node<T>&
4646
{
47-
const auto value = find(key);
48-
if (value == std::cend(nodes))
47+
if (const auto value = find(key); value == std::cend(nodes)) [[unlikely]]
4948
throw std::out_of_range{"The Node does not contain the requested child."};
50-
return *value;
49+
else
50+
return *value;
5151
}
5252

5353
[[nodiscard]] inline constexpr auto getNodesWithValue(const ValueType& filterValue) const

0 commit comments

Comments
 (0)