Fix perfect forwarding in constructor args in util::pathfinder

This commit is contained in:
Nikita Lisitsa 2024-02-07 14:14:13 +03:00
parent 752593a589
commit 929e8091dc

View file

@ -39,10 +39,11 @@ namespace psemek::util
util::hash_map<Node, Node> previous;
std::set<Node, node_compare> queue;
pathfinder(NeighboursFn && node_neighbours, HeuristicFn && heuristic, EdgeCallback && edge_callback)
: node_neighbours(std::forward<NeighboursFn>(node_neighbours))
, heuristic(std::forward<HeuristicFn>(heuristic))
, edge_callback(std::forward<EdgeCallback>(edge_callback))
template <typename NeighboursFn1, typename HeuristicFn1, typename EdgeCallback1>
pathfinder(NeighboursFn1 && node_neighbours, HeuristicFn1 && heuristic, EdgeCallback1 && edge_callback)
: node_neighbours(std::forward<NeighboursFn1>(node_neighbours))
, heuristic(std::forward<HeuristicFn1>(heuristic))
, edge_callback(std::forward<EdgeCallback1>(edge_callback))
, queue(node_compare{priority})
{}