Topology::remove: simplify
Use std::erase to remove strings from the vector, which simplifies the
code.
Tested: Topology Unit Tests Pass
Change-Id: I212fcc50dd30dc3131826c17e8f526bd3a9a2c9d
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/src/entity_manager/topology.cpp b/src/entity_manager/topology.cpp
index 5ae4d94..2142cdf 100644
--- a/src/entity_manager/topology.cpp
+++ b/src/entity_manager/topology.cpp
@@ -101,21 +101,11 @@
for (auto& upstreamPort : upstreamPorts)
{
- auto pathIt = std::find(upstreamPort.second.begin(),
- upstreamPort.second.end(), boardPath);
- if (pathIt != upstreamPort.second.end())
- {
- upstreamPort.second.erase(pathIt);
- }
+ std::erase(upstreamPort.second, boardPath);
}
for (auto& downstreamPort : downstreamPorts)
{
- auto pathIt = std::find(downstreamPort.second.begin(),
- downstreamPort.second.end(), boardPath);
- if (pathIt != downstreamPort.second.end())
- {
- downstreamPort.second.erase(pathIt);
- }
+ std::erase(downstreamPort.second, boardPath);
}
}