Merge pull request #277 from isildur-g/wip-cppcheck271

phase 1 of addressing cppcheck useStlAlgorithm warnings for fill and copy operations
This commit is contained in:
Konstantinos Margaritis
2024-05-15 10:44:15 +03:00
committed by GitHub
19 changed files with 102 additions and 98 deletions

View File

@@ -571,6 +571,9 @@ bool transformMinLengthToRepeat(NGHolder &g, ReportManager &rm) {
vector<NFAVertex> predcs;
vector<NFAEdge> dead;
auto deads = [&g=g](const NFAEdge &e) {
return (target(e, g) != g.startDs);
};
for (auto u : inv_adjacent_vertices_range(cyclic, g)) {
DEBUG_PRINTF("pred %zu\n", g[u].index);
if (u == cyclic) {
@@ -580,11 +583,9 @@ bool transformMinLengthToRepeat(NGHolder &g, ReportManager &rm) {
// We want to delete the out-edges of each predecessor, but need to
// make sure we don't delete the startDs self loop.
for (const auto &e : out_edges_range(u, g)) {
if (target(e, g) != g.startDs) {
dead.emplace_back(e);
}
}
const auto &e = out_edges_range(u, g);
std::copy_if(begin(e), end(e), std::back_inserter(dead), deads);
}
remove_edges(dead, g);