fix reference to popped queue element

This commit is contained in:
Eric Mertens 2022-11-27 11:54:47 -08:00
parent c8470bb8dc
commit 234217e6cc

View File

@ -128,7 +128,7 @@ auto SolveMaze(Distances const& distances, bool const recursive) -> std::int64_t
todo.emplace(0, 0, "-AA"); todo.emplace(0, 0, "-AA");
while(!todo.empty()) { while(!todo.empty()) {
auto const& [steps, depth, name] = todo.top(); auto const [steps, depth, name] = std::move(todo.top());
todo.pop(); todo.pop();
if (name == "-ZZ") { return steps; } if (name == "-ZZ") { return steps; }
if (seen.emplace(depth, name).second) { if (seen.emplace(depth, name).second) {