Use util::hash_map instead of std::unordered_map for pathfinder

This commit is contained in:
Nikita Lisitsa 2024-01-29 17:44:27 +03:00
parent 64a6713b61
commit 099a09e4d9

View file

@ -1,8 +1,8 @@
#pragma once #pragma once
#include <psemek/util/functional.hpp> #include <psemek/util/functional.hpp>
#include <psemek/util/hash_table.hpp>
#include <unordered_map>
#include <set> #include <set>
#include <deque> #include <deque>
#include <optional> #include <optional>
@ -15,7 +15,7 @@ namespace psemek::util
{ {
struct node_compare struct node_compare
{ {
std::unordered_map<Node, Cost> const & priority; util::hash_map<Node, Cost> const & priority;
bool operator()(Node const & n1, Node const & n2) const bool operator()(Node const & n1, Node const & n2) const
{ {
@ -34,9 +34,9 @@ namespace psemek::util
HeuristicFn heuristic; HeuristicFn heuristic;
EdgeCallback edge_callback; EdgeCallback edge_callback;
std::unordered_map<Node, Cost> cost; util::hash_map<Node, Cost> cost;
std::unordered_map<Node, Cost> priority; util::hash_map<Node, Cost> priority;
std::unordered_map<Node, Node> previous; util::hash_map<Node, Node> previous;
std::set<Node, node_compare> queue; std::set<Node, node_compare> queue;
pathfinder(NeighboursFn && node_neighbours, HeuristicFn && heuristic, EdgeCallback && edge_callback) pathfinder(NeighboursFn && node_neighbours, HeuristicFn && heuristic, EdgeCallback && edge_callback)