From 5e0f226322b67a57c156039df5ed115521ea7415 Mon Sep 17 00:00:00 2001 From: Siarhei Fedartsou Date: Wed, 22 May 2024 17:50:26 +0200 Subject: [PATCH] use constexpr if --- .../routing_algorithms/routing_base_mld.hpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/include/engine/routing_algorithms/routing_base_mld.hpp b/include/engine/routing_algorithms/routing_base_mld.hpp index d4e3e9f21..2ae896cc8 100644 --- a/include/engine/routing_algorithms/routing_base_mld.hpp +++ b/include/engine/routing_algorithms/routing_base_mld.hpp @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -311,15 +312,16 @@ void relaxOutgoingEdges(const DataFacade &facade, const auto &cell = cells.GetCell(metric, level, partition.GetCell(level, heapNode.node)); auto destination = cell.GetDestinationNodes().begin(); - auto distance = [&]() -> auto + auto distance = [&cell, node = heapNode.node ]() -> auto { if constexpr (IS_MAP_MATCHING) { - return cell.GetOutDistance(heapNode.node).begin(); + return cell.GetOutDistance(node).begin(); } else { + boost::ignore_unused(cell, node); return 0; } } @@ -346,7 +348,7 @@ void relaxOutgoingEdges(const DataFacade &facade, } } ++destination; - if (IS_MAP_MATCHING) + if constexpr (IS_MAP_MATCHING) { ++distance; } @@ -358,15 +360,16 @@ void relaxOutgoingEdges(const DataFacade &facade, const auto &cell = cells.GetCell(metric, level, partition.GetCell(level, heapNode.node)); auto source = cell.GetSourceNodes().begin(); - auto distance = [&]() -> auto + auto distance = [&cell, node = heapNode.node ]() -> auto { if constexpr (IS_MAP_MATCHING) { - return cell.GetInDistance(heapNode.node).begin(); + return cell.GetInDistance(node).begin(); } else { + boost::ignore_unused(cell, node); return 0; } } @@ -392,7 +395,7 @@ void relaxOutgoingEdges(const DataFacade &facade, } } ++source; - if (IS_MAP_MATCHING) + if constexpr (IS_MAP_MATCHING) { ++distance; }