Skip to content

Commit 5517265

Browse files
committed
fix cppcheck
1 parent 4924b48 commit 5517265

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

tests/library_checker_aizu_tests/graphs/bcc_callback_aizu_two_edge_cc.test.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,8 @@ int main() {
2020
int count_edges = 0;
2121
rep(i, 0, sz(nodes) - 1) {
2222
seen[nodes[i]] = 1;
23-
for (int v : adj[nodes[i]])
24-
if (!seen[v]) {
25-
// edge nodes[i] <=> v is in current BCC
26-
count_edges++;
27-
}
23+
count_edges += ranges::count_if(adj[nodes[i]],
24+
[&](int v) -> bool { return !seen[v]; });
2825
}
2926
if (count_edges == 1) {
3027
assert(sz(nodes) == 2);

tests/library_checker_aizu_tests/graphs/bcc_callback_lib_checker_two_cc.test.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,8 @@ int main() {
2020
int count_edges = 0;
2121
rep(i, 0, sz(nodes) - 1) {
2222
seen[nodes[i]] = 1;
23-
for (int v : adj[nodes[i]])
24-
if (!seen[v]) {
25-
// edge nodes[i] <=> v is in current BCC
26-
count_edges++;
27-
}
23+
count_edges += ranges::count_if(adj[nodes[i]],
24+
[&](int v) -> bool { return !seen[v]; });
2825
}
2926
if (count_edges == 1) {
3027
assert(sz(nodes) == 2);

0 commit comments

Comments
 (0)