mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:37:35 +00:00
AK: Add take_first
to HashTable and rename pop
to take_last
This naming scheme matches Vector. This also changes `take_last` to move the value it takes, and delete by known pointer, avoiding a full lookup and potential copies.
This commit is contained in:
parent
93945062a7
commit
fd8c54d720
3 changed files with 45 additions and 8 deletions
|
@ -76,7 +76,7 @@ static void prioritize_nodes(Node& start, NodeMap& node_map, NodeStack& stack, b
|
|||
node.status = NodeStatus::Prioritized;
|
||||
outln("{}", stack.take_last().name);
|
||||
} else {
|
||||
auto next_ancestor_name = node.ancestors.pop();
|
||||
auto next_ancestor_name = node.ancestors.take_last();
|
||||
auto& next_ancestor = node_map.get(next_ancestor_name).release_value();
|
||||
if (next_ancestor.status == NodeStatus::Seen)
|
||||
// If the same node is seen multiple times, this represents a cycle in
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue