phase 1 of addressing cppcheck useStlAlgorithm warnings,

this set only includes fill and copy operations.
This commit is contained in:
G.E
2024-05-14 17:37:38 +03:00
parent 5ebc19674c
commit b541288cd5
19 changed files with 102 additions and 98 deletions

View File

@@ -571,6 +571,9 @@ bool transformMinLengthToRepeat(NGHolder &g, ReportManager &rm) {
vector<NFAVertex> preds;
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);