use constexpr if
This commit is contained in:
parent
8654b16d8b
commit
09211b76e0
16
.github/workflows/osrm-backend.yml
vendored
16
.github/workflows/osrm-backend.yml
vendored
@ -265,14 +265,14 @@ jobs:
|
|||||||
CXXCOMPILER: g++-12
|
CXXCOMPILER: g++-12
|
||||||
CXXFLAGS: '-Wno-array-bounds -Wno-uninitialized'
|
CXXFLAGS: '-Wno-array-bounds -Wno-uninitialized'
|
||||||
|
|
||||||
# - name: gcc-11-release
|
- name: gcc-11-release
|
||||||
# continue-on-error: false
|
continue-on-error: false
|
||||||
# node: 20
|
node: 20
|
||||||
# runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
# BUILD_TOOLS: ON
|
BUILD_TOOLS: ON
|
||||||
# BUILD_TYPE: Release
|
BUILD_TYPE: Release
|
||||||
# CCOMPILER: gcc-11
|
CCOMPILER: gcc-11
|
||||||
# CXXCOMPILER: g++-11
|
CXXCOMPILER: g++-11
|
||||||
|
|
||||||
- name: conan-linux-release-node
|
- name: conan-linux-release-node
|
||||||
build_node_package: true
|
build_node_package: true
|
||||||
|
@ -290,18 +290,23 @@ void relaxOutgoingEdges(const DataFacade<Algorithm> &facade,
|
|||||||
const auto &cell =
|
const auto &cell =
|
||||||
cells.GetCell(metric, level, partition.GetCell(level, heapNode.node));
|
cells.GetCell(metric, level, partition.GetCell(level, heapNode.node));
|
||||||
auto destination = cell.GetDestinationNodes().begin();
|
auto destination = cell.GetDestinationNodes().begin();
|
||||||
auto distance = [&heapNode, &cell]() -> auto {
|
auto distance = [&heapNode, &cell ]() -> auto
|
||||||
if constexpr (std::is_same_v<typename SearchEngineData<
|
{
|
||||||
mld::Algorithm>::MapMatchingQueryHeap,
|
if constexpr (std::is_same_v<
|
||||||
Heap>) {
|
typename SearchEngineData<mld::Algorithm>::MapMatchingQueryHeap,
|
||||||
|
Heap>)
|
||||||
|
{
|
||||||
|
|
||||||
return cell.GetOutDistance(heapNode.node).begin();
|
return cell.GetOutDistance(heapNode.node).begin();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
(void)cell;
|
(void)cell;
|
||||||
(void)heapNode;
|
(void)heapNode;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}();
|
}
|
||||||
|
();
|
||||||
for (auto shortcut_weight : cell.GetOutWeight(heapNode.node))
|
for (auto shortcut_weight : cell.GetOutWeight(heapNode.node))
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(destination != cell.GetDestinationNodes().end());
|
BOOST_ASSERT(destination != cell.GetDestinationNodes().end());
|
||||||
@ -353,18 +358,23 @@ void relaxOutgoingEdges(const DataFacade<Algorithm> &facade,
|
|||||||
const auto &cell =
|
const auto &cell =
|
||||||
cells.GetCell(metric, level, partition.GetCell(level, heapNode.node));
|
cells.GetCell(metric, level, partition.GetCell(level, heapNode.node));
|
||||||
auto source = cell.GetSourceNodes().begin();
|
auto source = cell.GetSourceNodes().begin();
|
||||||
auto distance = [&heapNode, &cell]() -> auto {
|
auto distance = [&heapNode, &cell ]() -> auto
|
||||||
if constexpr (std::is_same_v<typename SearchEngineData<
|
{
|
||||||
mld::Algorithm>::MapMatchingQueryHeap,
|
if constexpr (std::is_same_v<
|
||||||
Heap>) {
|
typename SearchEngineData<mld::Algorithm>::MapMatchingQueryHeap,
|
||||||
|
Heap>)
|
||||||
|
{
|
||||||
|
|
||||||
return cell.GetOutDistance(heapNode.node).begin();
|
return cell.GetOutDistance(heapNode.node).begin();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
(void)cell;
|
(void)cell;
|
||||||
(void)heapNode;
|
(void)heapNode;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}();
|
}
|
||||||
|
();
|
||||||
for (auto shortcut_weight : cell.GetInWeight(heapNode.node))
|
for (auto shortcut_weight : cell.GetInWeight(heapNode.node))
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(source != cell.GetSourceNodes().end());
|
BOOST_ASSERT(source != cell.GetSourceNodes().end());
|
||||||
@ -437,13 +447,12 @@ void relaxOutgoingEdges(const DataFacade<Algorithm> &facade,
|
|||||||
const auto toHeapNode = forward_heap.GetHeapNodeIfWasInserted(to);
|
const auto toHeapNode = forward_heap.GetHeapNodeIfWasInserted(to);
|
||||||
if (!toHeapNode)
|
if (!toHeapNode)
|
||||||
{
|
{
|
||||||
if constexpr (std::is_same_v<
|
if constexpr (std::is_same_v<typename SearchEngineData<
|
||||||
typename SearchEngineData<mld::Algorithm>::MapMatchingQueryHeap,
|
mld::Algorithm>::MapMatchingQueryHeap,
|
||||||
Heap>)
|
Heap>)
|
||||||
{
|
{
|
||||||
const auto node_distance =
|
const auto node_distance = facade.GetNodeDistance(
|
||||||
facade.GetNodeDistance(DIRECTION == FORWARD_DIRECTION ? heapNode.node : to);
|
DIRECTION == FORWARD_DIRECTION ? heapNode.node : to);
|
||||||
|
|
||||||
|
|
||||||
const EdgeDistance to_distance = heapNode.data.distance + node_distance;
|
const EdgeDistance to_distance = heapNode.data.distance + node_distance;
|
||||||
forward_heap.Insert(to, to_weight, {heapNode.node, false, to_distance});
|
forward_heap.Insert(to, to_weight, {heapNode.node, false, to_distance});
|
||||||
@ -455,13 +464,12 @@ void relaxOutgoingEdges(const DataFacade<Algorithm> &facade,
|
|||||||
}
|
}
|
||||||
else if (to_weight < toHeapNode->weight)
|
else if (to_weight < toHeapNode->weight)
|
||||||
{
|
{
|
||||||
if constexpr (std::is_same_v<
|
if constexpr (std::is_same_v<typename SearchEngineData<
|
||||||
typename SearchEngineData<mld::Algorithm>::MapMatchingQueryHeap,
|
mld::Algorithm>::MapMatchingQueryHeap,
|
||||||
Heap>)
|
Heap>)
|
||||||
{
|
{
|
||||||
const auto node_distance =
|
const auto node_distance = facade.GetNodeDistance(
|
||||||
facade.GetNodeDistance(DIRECTION == FORWARD_DIRECTION ? heapNode.node : to);
|
DIRECTION == FORWARD_DIRECTION ? heapNode.node : to);
|
||||||
|
|
||||||
|
|
||||||
const EdgeDistance to_distance = heapNode.data.distance + node_distance;
|
const EdgeDistance to_distance = heapNode.data.distance + node_distance;
|
||||||
toHeapNode->data = {heapNode.node, false, to_distance};
|
toHeapNode->data = {heapNode.node, false, to_distance};
|
||||||
|
Loading…
Reference in New Issue
Block a user