Skip to content

Commit aeee182

Browse files
cameroncusterCameron Custerweb-flow
authored
library: C++23 — deducing this for some recursive lambdas (#229)
* tests/infra: move to c++23 (std pins, g++-14 in CI, deducing this in tests) * revert deducing this in member-function lambdas (gcc 14/15 bug PR118291) * library: c++23 deducing this for all 22 recursive lambdas; tester.sh to c++23 * revert deducing this in member-function lambdas (gcc 14/15 bug PR118291) * suppress clang-tidy suspicious-call-argument false positive in min_plus dnc; generalize NOLINT strip in update_main * [auto-verifier] verify commit a12b59b * [auto-verifier] verify commit ce89ffc --------- Co-authored-by: Cameron Custer <cam@augmentcode.com> Co-authored-by: GitHub <noreply@github.com>
1 parent d402f56 commit aeee182

15 files changed

Lines changed: 92 additions & 91 deletions

.verify-helper/timestamps.remote.json

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"tests/library_checker_aizu_tests/convolution/gcd_convolution.test.cpp": "2026-07-06 13:10:16 -0700",
33
"tests/library_checker_aizu_tests/convolution/lcm_convolution.test.cpp": "2026-07-06 13:10:16 -0700",
4-
"tests/library_checker_aizu_tests/convolution/min_plus_convolution.test.cpp": "2026-07-06 13:10:16 -0700",
4+
"tests/library_checker_aizu_tests/convolution/min_plus_convolution.test.cpp": "2026-07-06 22:52:18 -0700",
55
"tests/library_checker_aizu_tests/convolution/xor_convolution.test.cpp": "2026-07-06 13:10:16 -0700",
66
"tests/library_checker_aizu_tests/data_structures/binary_search_example.test.cpp": "2026-07-06 13:10:16 -0700",
77
"tests/library_checker_aizu_tests/data_structures/binary_trie.test.cpp": "2026-07-06 11:00:20 -0700",
@@ -30,7 +30,7 @@
3030
"tests/library_checker_aizu_tests/data_structures/lazy_segment_tree_inc_constructor.test.cpp": "2026-07-06 13:10:16 -0700",
3131
"tests/library_checker_aizu_tests/data_structures/merge_sort_tree.test.cpp": "2026-07-06 13:10:16 -0700",
3232
"tests/library_checker_aizu_tests/data_structures/mode_query.test.cpp": "2026-07-06 13:10:16 -0700",
33-
"tests/library_checker_aizu_tests/data_structures/permutation_tree.test.cpp": "2026-07-06 22:18:09 -0700",
33+
"tests/library_checker_aizu_tests/data_structures/permutation_tree.test.cpp": "2026-07-07 09:17:02 -0700",
3434
"tests/library_checker_aizu_tests/data_structures/persistent_queue_tree.test.cpp": "2026-07-06 13:10:16 -0700",
3535
"tests/library_checker_aizu_tests/data_structures/persistent_seg_tree.test.cpp": "2026-07-06 13:10:16 -0700",
3636
"tests/library_checker_aizu_tests/data_structures/pq_ds_undo_sliding_window.test.cpp": "2026-07-06 13:10:16 -0700",
@@ -49,39 +49,39 @@
4949
"tests/library_checker_aizu_tests/dsu/dsu_bipartite.test.cpp": "2026-07-06 13:10:16 -0700",
5050
"tests/library_checker_aizu_tests/dsu/dsu_weighted_aizu.test.cpp": "2026-07-06 13:49:19 -0700",
5151
"tests/library_checker_aizu_tests/dsu/dsu_weighted_lib_checker.test.cpp": "2026-07-06 13:49:19 -0700",
52-
"tests/library_checker_aizu_tests/dsu/kruskal_tree_aizu.test.cpp": "2026-07-06 22:18:09 -0700",
52+
"tests/library_checker_aizu_tests/dsu/kruskal_tree_aizu.test.cpp": "2026-07-07 09:17:02 -0700",
5353
"tests/library_checker_aizu_tests/dsu/line_tree_aizu.test.cpp": "2026-07-06 13:10:16 -0700",
5454
"tests/library_checker_aizu_tests/dsu/line_tree_lib_checker.test.cpp": "2026-07-06 13:10:16 -0700",
5555
"tests/library_checker_aizu_tests/dsu/range_parallel_dsu.test.cpp": "2026-07-06 13:10:16 -0700",
5656
"tests/library_checker_aizu_tests/flow/hungarian.test.cpp": "2026-07-06 13:09:48 -0700",
5757
"tests/library_checker_aizu_tests/flow/min_cost_max_flow.test.cpp": "2026-04-06 14:41:55 -0600",
58-
"tests/library_checker_aizu_tests/graphs/bcc_callback_aizu_bcc.test.cpp": "2026-07-06 13:10:16 -0700",
59-
"tests/library_checker_aizu_tests/graphs/bcc_callback_aizu_two_edge_cc.test.cpp": "2026-07-06 13:10:16 -0700",
60-
"tests/library_checker_aizu_tests/graphs/bcc_callback_lib_checker_bcc.test.cpp": "2026-07-06 13:10:16 -0700",
61-
"tests/library_checker_aizu_tests/graphs/bcc_callback_lib_checker_two_cc.test.cpp": "2026-07-06 13:10:16 -0700",
62-
"tests/library_checker_aizu_tests/graphs/biconnected_components.test.cpp": "2026-07-06 13:10:16 -0700",
58+
"tests/library_checker_aizu_tests/graphs/bcc_callback_aizu_bcc.test.cpp": "2026-07-06 22:30:55 -0700",
59+
"tests/library_checker_aizu_tests/graphs/bcc_callback_aizu_two_edge_cc.test.cpp": "2026-07-06 22:30:55 -0700",
60+
"tests/library_checker_aizu_tests/graphs/bcc_callback_lib_checker_bcc.test.cpp": "2026-07-06 22:30:55 -0700",
61+
"tests/library_checker_aizu_tests/graphs/bcc_callback_lib_checker_two_cc.test.cpp": "2026-07-06 22:30:55 -0700",
62+
"tests/library_checker_aizu_tests/graphs/biconnected_components.test.cpp": "2026-07-06 22:30:55 -0700",
6363
"tests/library_checker_aizu_tests/graphs/connected_components_of_complement_graph.test.cpp": "2026-07-06 13:10:16 -0700",
6464
"tests/library_checker_aizu_tests/graphs/dijkstra_aizu.test.cpp": "2026-07-06 13:10:16 -0700",
65-
"tests/library_checker_aizu_tests/graphs/dijkstra_lib_checker.test.cpp": "2026-07-06 22:18:09 -0700",
66-
"tests/library_checker_aizu_tests/graphs/directed_cycle.test.cpp": "2026-07-06 13:10:16 -0700",
65+
"tests/library_checker_aizu_tests/graphs/dijkstra_lib_checker.test.cpp": "2026-07-07 09:17:02 -0700",
66+
"tests/library_checker_aizu_tests/graphs/directed_cycle.test.cpp": "2026-07-06 22:30:55 -0700",
6767
"tests/library_checker_aizu_tests/graphs/enumerate_triangles.test.cpp": "2026-07-06 13:10:16 -0700",
68-
"tests/library_checker_aizu_tests/graphs/euler_walk_directed.test.cpp": "2026-07-06 13:10:16 -0700",
69-
"tests/library_checker_aizu_tests/graphs/euler_walk_undirected.test.cpp": "2026-07-06 13:10:16 -0700",
68+
"tests/library_checker_aizu_tests/graphs/euler_walk_directed.test.cpp": "2026-07-06 22:30:55 -0700",
69+
"tests/library_checker_aizu_tests/graphs/euler_walk_undirected.test.cpp": "2026-07-06 22:30:55 -0700",
7070
"tests/library_checker_aizu_tests/graphs/hopcroft_karp_aizu.test.cpp": "2026-07-06 13:10:16 -0700",
7171
"tests/library_checker_aizu_tests/graphs/hopcroft_karp_lib_checker.test.cpp": "2026-07-06 13:10:16 -0700",
7272
"tests/library_checker_aizu_tests/graphs/mst.test.cpp": "2026-07-06 13:09:48 -0700",
73-
"tests/library_checker_aizu_tests/graphs/offline_incremental_scc.test.cpp": "2026-07-06 13:10:16 -0700",
74-
"tests/library_checker_aizu_tests/graphs/strongly_connected_components_aizu.test.cpp": "2026-07-06 13:10:16 -0700",
75-
"tests/library_checker_aizu_tests/graphs/strongly_connected_components_lib_checker.test.cpp": "2026-07-06 13:10:16 -0700",
76-
"tests/library_checker_aizu_tests/graphs/two_edge_components.test.cpp": "2026-07-06 13:10:16 -0700",
77-
"tests/library_checker_aizu_tests/handmade_tests/count_paths.test.cpp": "2026-07-06 22:18:09 -0700",
78-
"tests/library_checker_aizu_tests/handmade_tests/dsu.test.cpp": "2026-07-06 22:18:09 -0700",
79-
"tests/library_checker_aizu_tests/handmade_tests/edge_cd_small_trees.test.cpp": "2026-07-06 22:18:09 -0700",
73+
"tests/library_checker_aizu_tests/graphs/offline_incremental_scc.test.cpp": "2026-07-06 22:30:55 -0700",
74+
"tests/library_checker_aizu_tests/graphs/strongly_connected_components_aizu.test.cpp": "2026-07-06 22:30:55 -0700",
75+
"tests/library_checker_aizu_tests/graphs/strongly_connected_components_lib_checker.test.cpp": "2026-07-06 22:30:55 -0700",
76+
"tests/library_checker_aizu_tests/graphs/two_edge_components.test.cpp": "2026-07-06 22:30:55 -0700",
77+
"tests/library_checker_aizu_tests/handmade_tests/count_paths.test.cpp": "2026-07-06 22:44:57 -0700",
78+
"tests/library_checker_aizu_tests/handmade_tests/dsu.test.cpp": "2026-07-07 09:17:02 -0700",
79+
"tests/library_checker_aizu_tests/handmade_tests/edge_cd_small_trees.test.cpp": "2026-07-06 22:30:55 -0700",
8080
"tests/library_checker_aizu_tests/handmade_tests/fib_matrix_expo.test.cpp": "2026-07-06 13:10:16 -0700",
8181
"tests/library_checker_aizu_tests/handmade_tests/functional_graph.test.cpp": "2026-07-06 22:43:37 -0700",
8282
"tests/library_checker_aizu_tests/handmade_tests/hilbert_mos.test.cpp": "2026-07-06 13:10:16 -0700",
8383
"tests/library_checker_aizu_tests/handmade_tests/kd_bit.test.cpp": "2026-07-06 13:10:16 -0700",
84-
"tests/library_checker_aizu_tests/handmade_tests/kth_par.test.cpp": "2026-07-06 13:10:16 -0700",
84+
"tests/library_checker_aizu_tests/handmade_tests/kth_par.test.cpp": "2026-07-06 22:44:57 -0700",
8585
"tests/library_checker_aizu_tests/handmade_tests/manacher.test.cpp": "2026-07-06 13:10:16 -0700",
8686
"tests/library_checker_aizu_tests/handmade_tests/merge_st_and_wavelet.test.cpp": "2026-07-06 13:10:16 -0700",
8787
"tests/library_checker_aizu_tests/handmade_tests/mobius.test.cpp": "2026-07-06 13:10:16 -0700",
@@ -92,7 +92,7 @@
9292
"tests/library_checker_aizu_tests/handmade_tests/sa_find_subarray.test.cpp": "2026-07-06 13:10:16 -0700",
9393
"tests/library_checker_aizu_tests/handmade_tests/seg_tree_find.test.cpp": "2026-07-06 13:10:16 -0700",
9494
"tests/library_checker_aizu_tests/handmade_tests/seg_tree_find_small.test.cpp": "2026-07-06 13:10:16 -0700",
95-
"tests/library_checker_aizu_tests/handmade_tests/seg_tree_midpoint.test.cpp": "2026-07-06 22:18:09 -0700",
95+
"tests/library_checker_aizu_tests/handmade_tests/seg_tree_midpoint.test.cpp": "2026-07-07 09:17:02 -0700",
9696
"tests/library_checker_aizu_tests/handmade_tests/xor_basis_walk.test.cpp": "2026-07-06 13:10:16 -0700",
9797
"tests/library_checker_aizu_tests/loops/chooses.test.cpp": "2026-07-06 13:10:16 -0700",
9898
"tests/library_checker_aizu_tests/loops/quotients.test.cpp": "2026-07-06 13:10:16 -0700",
@@ -132,23 +132,23 @@
132132
"tests/library_checker_aizu_tests/strings/suffix_array_short.test.cpp": "2026-04-12 06:15:25 -0600",
133133
"tests/library_checker_aizu_tests/strings/trie.test.cpp": "2026-07-06 13:10:16 -0700",
134134
"tests/library_checker_aizu_tests/strings/wildcard_pattern_matching.test.cpp": "2026-07-06 13:10:16 -0700",
135-
"tests/library_checker_aizu_tests/trees/cd_count_paths_per_length.test.cpp": "2026-07-06 22:18:09 -0700",
136-
"tests/library_checker_aizu_tests/trees/edge_cd_contour_range_query.test.cpp": "2026-07-06 22:43:37 -0700",
137-
"tests/library_checker_aizu_tests/trees/edge_cd_contour_range_update.test.cpp": "2026-07-06 22:43:37 -0700",
138-
"tests/library_checker_aizu_tests/trees/edge_cd_count_paths_per_length.test.cpp": "2026-07-06 22:18:09 -0700",
139-
"tests/library_checker_aizu_tests/trees/edge_cd_reroot_dp.test.cpp": "2026-07-06 22:18:09 -0700",
140-
"tests/library_checker_aizu_tests/trees/hld_aizu1.test.cpp": "2026-07-06 13:10:16 -0700",
141-
"tests/library_checker_aizu_tests/trees/hld_aizu2.test.cpp": "2026-07-06 13:10:16 -0700",
142-
"tests/library_checker_aizu_tests/trees/hld_lib_checker_path.test.cpp": "2026-07-06 13:10:16 -0700",
143-
"tests/library_checker_aizu_tests/trees/hld_lib_checker_subtree_edges.test.cpp": "2026-07-06 13:10:16 -0700",
144-
"tests/library_checker_aizu_tests/trees/hld_lib_checker_subtree_nodes.test.cpp": "2026-07-06 13:10:16 -0700",
145-
"tests/library_checker_aizu_tests/trees/kth_path_hagerup.test.cpp": "2026-07-06 13:10:16 -0700",
146-
"tests/library_checker_aizu_tests/trees/kth_path_ladder.test.cpp": "2026-07-06 13:10:16 -0700",
147-
"tests/library_checker_aizu_tests/trees/kth_path_linear.test.cpp": "2026-07-06 13:10:16 -0700",
148-
"tests/library_checker_aizu_tests/trees/kth_path_tree_lift.test.cpp": "2026-07-06 13:10:16 -0700",
149-
"tests/library_checker_aizu_tests/trees/lca_all_methods_aizu.test.cpp": "2026-07-06 13:10:16 -0700",
150-
"tests/library_checker_aizu_tests/trees/lca_all_methods_lib_checker.test.cpp": "2026-07-06 13:10:16 -0700",
151-
"tests/library_checker_aizu_tests/trees/shallowest_aizu_tree_height.test.cpp": "2026-07-06 22:18:09 -0700",
152-
"tests/library_checker_aizu_tests/trees/shallowest_lib_checker_tree_path_composite.test.cpp": "2026-07-06 22:18:09 -0700",
153-
"tests/library_checker_aizu_tests/trees/subtree_isomorphism.test.cpp": "2026-07-06 13:10:16 -0700"
135+
"tests/library_checker_aizu_tests/trees/cd_count_paths_per_length.test.cpp": "2026-07-06 22:30:55 -0700",
136+
"tests/library_checker_aizu_tests/trees/edge_cd_contour_range_query.test.cpp": "2026-07-06 22:30:55 -0700",
137+
"tests/library_checker_aizu_tests/trees/edge_cd_contour_range_update.test.cpp": "2026-07-06 22:30:55 -0700",
138+
"tests/library_checker_aizu_tests/trees/edge_cd_count_paths_per_length.test.cpp": "2026-07-06 22:30:55 -0700",
139+
"tests/library_checker_aizu_tests/trees/edge_cd_reroot_dp.test.cpp": "2026-07-06 22:30:55 -0700",
140+
"tests/library_checker_aizu_tests/trees/hld_aizu1.test.cpp": "2026-07-06 22:44:57 -0700",
141+
"tests/library_checker_aizu_tests/trees/hld_aizu2.test.cpp": "2026-07-06 22:44:57 -0700",
142+
"tests/library_checker_aizu_tests/trees/hld_lib_checker_path.test.cpp": "2026-07-06 22:44:57 -0700",
143+
"tests/library_checker_aizu_tests/trees/hld_lib_checker_subtree_edges.test.cpp": "2026-07-06 22:44:57 -0700",
144+
"tests/library_checker_aizu_tests/trees/hld_lib_checker_subtree_nodes.test.cpp": "2026-07-06 22:44:57 -0700",
145+
"tests/library_checker_aizu_tests/trees/kth_path_hagerup.test.cpp": "2026-07-06 22:44:57 -0700",
146+
"tests/library_checker_aizu_tests/trees/kth_path_ladder.test.cpp": "2026-07-06 22:44:57 -0700",
147+
"tests/library_checker_aizu_tests/trees/kth_path_linear.test.cpp": "2026-07-06 22:44:57 -0700",
148+
"tests/library_checker_aizu_tests/trees/kth_path_tree_lift.test.cpp": "2026-07-06 22:44:57 -0700",
149+
"tests/library_checker_aizu_tests/trees/lca_all_methods_aizu.test.cpp": "2026-07-06 22:44:57 -0700",
150+
"tests/library_checker_aizu_tests/trees/lca_all_methods_lib_checker.test.cpp": "2026-07-06 22:44:57 -0700",
151+
"tests/library_checker_aizu_tests/trees/shallowest_aizu_tree_height.test.cpp": "2026-07-06 22:30:55 -0700",
152+
"tests/library_checker_aizu_tests/trees/shallowest_lib_checker_tree_path_composite.test.cpp": "2026-07-06 22:30:55 -0700",
153+
"tests/library_checker_aizu_tests/trees/subtree_isomorphism.test.cpp": "2026-07-06 22:30:55 -0700"
154154
}

library/contest/tester.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# https://github.com/Errichto/youtube/blob/master/testing/s.sh
22
# bash tester.sh a naive gen
33

4-
g++ -std=c++20 -g -D_GLIBCXX_DEBUG -fsanitize=address,undefined $1.cpp -o $1.out
5-
g++ -std=c++20 $2.cpp -o $2.out
6-
g++ -std=c++20 $3.cpp -o $3.out
4+
g++ -std=c++23 -g -D_GLIBCXX_DEBUG -fsanitize=address,undefined $1.cpp -o $1.out
5+
g++ -std=c++23 $2.cpp -o $2.out
6+
g++ -std=c++23 $3.cpp -o $3.out
77

88
for((i = 1; ; ++i))
99
do

library/convolution/min_plus_convolution_convex_and_arbitrary.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ vi min_plus(const vi& convex, const vi& arbitrary) {
99
int n = sz(convex);
1010
int m = sz(arbitrary);
1111
vi res(n + m - 1, INT_MAX);
12-
auto dnc = [&](auto&& dnc, int res_le, int res_ri,
12+
auto dnc = [&](this auto&& dnc, int res_le, int res_ri,
1313
int arb_le, int arb_ri) {
1414
if (res_le >= res_ri) return;
1515
int mid_res = (res_le + res_ri) / 2;
@@ -22,10 +22,10 @@ vi min_plus(const vi& convex, const vi& arbitrary) {
2222
op_arb = i;
2323
}
2424
}
25-
dnc(dnc, res_le, mid_res, arb_le,
26-
min(arb_ri, op_arb + 1));
27-
dnc(dnc, mid_res + 1, res_ri, op_arb, arb_ri);
25+
dnc(res_le, mid_res, arb_le, min(arb_ri, op_arb + 1));
26+
// NOLINTNEXTLINE(readability-suspicious-call-argument)
27+
dnc(mid_res + 1, res_ri, op_arb, arb_ri);
2828
};
29-
dnc(dnc, 0, n + m - 1, 0, m);
29+
dnc(0, n + m - 1, 0, m);
3030
return res;
3131
}

library/graphs/bcc_callback.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@
4444
void bcc(const auto& g, auto f) {
4545
int n = sz(g), q = 0, s = 0;
4646
vi t(n), st(n);
47-
auto dfs = [&](auto&& dfs, int u) -> int {
47+
auto dfs = [&](this auto&& dfs, int u) -> int {
4848
int l = t[u] = ++q;
4949
for (int v : g[u]) {
5050
int siz = s, lu = 0;
51-
l = min(l, t[v] ?: (lu = dfs(dfs, st[s++] = v)));
51+
l = min(l, t[v] ?: (lu = dfs(st[s++] = v)));
5252
if (lu >= t[u]) {
5353
st[s++] = u;
5454
f({siz + all(st) - n + s});
@@ -57,5 +57,5 @@ void bcc(const auto& g, auto f) {
5757
}
5858
return l;
5959
};
60-
rep(i, 0, n) if (!t[i]) dfs(dfs, i);
60+
rep(i, 0, n) if (!t[i]) dfs(i);
6161
}

library/graphs/euler_path.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616
vector<pii> euler_path(auto& g, int m, int s) {
1717
vi vis(m);
1818
vector<pii> path;
19-
auto dfs = [&](auto&& dfs, int u, int eu) -> void {
19+
auto dfs = [&](this auto&& dfs, int u, int eu) -> void {
2020
while (!empty(g[u])) {
2121
auto [v, ev] = g[u].back();
2222
g[u].pop_back();
23-
if (!vis[ev]) vis[ev] = 1, dfs(dfs, v, ev);
23+
if (!vis[ev]) vis[ev] = 1, dfs(v, ev);
2424
}
2525
path.emplace_back(u, eu);
2626
};
27-
dfs(dfs, s, -1);
27+
dfs(s, -1);
2828
ranges::reverse(path);
2929
return path;
3030
}

library/graphs/scc.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,17 @@
1111
auto scc(const auto& g) {
1212
int n = sz(g), num_sccs = 0, q = 0, s = 0;
1313
vi scc_id(n, -1), tin(n), st(n);
14-
auto dfs = [&](auto&& dfs, int u) -> int {
14+
auto dfs = [&](this auto&& dfs, int u) -> int {
1515
int low = tin[u] = ++q;
1616
st[s++] = u;
1717
for (int v : g[u])
18-
if (scc_id[v] < 0)
19-
low = min(low, tin[v] ?: dfs(dfs, v));
18+
if (scc_id[v] < 0) low = min(low, tin[v] ?: dfs(v));
2019
if (tin[u] == low) {
2120
while (scc_id[u] < 0) scc_id[st[--s]] = num_sccs;
2221
num_sccs++;
2322
}
2423
return low;
2524
};
26-
rep(i, 0, n) if (!tin[i]) dfs(dfs, i);
25+
rep(i, 0, n) if (!tin[i]) dfs(i);
2726
return pair{num_sccs, scc_id};
2827
}

library/graphs/strongly_connected_components/add_edges_strongly_connected.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ vector<pii> extra_edges(const auto& g, int num_sccs,
2929
zero_in[scc_id[v]] = 0;
3030
}
3131
vector<bool> vis(num_sccs);
32-
auto dfs = [&](auto&& dfs, int u) {
32+
auto dfs = [&](this auto&& dfs, int u) {
3333
if (empty(scc_g[u])) return u;
3434
for (int v : scc_g[u])
3535
if (!vis[v]) {
3636
vis[v] = 1;
37-
int zero_out = dfs(dfs, v);
37+
int zero_out = dfs(v);
3838
if (zero_out != -1) return zero_out;
3939
}
4040
return -1;
@@ -43,7 +43,7 @@ vector<pii> extra_edges(const auto& g, int num_sccs,
4343
vi in_unused;
4444
rep(i, 0, num_sccs) if (zero_in[i]) {
4545
vis[i] = 1;
46-
int zero_out = dfs(dfs, i);
46+
int zero_out = dfs(i);
4747
if (zero_out != -1) edges.emplace_back(zero_out, i);
4848
else in_unused.push_back(i);
4949
}

library/graphs/strongly_connected_components/offline_incremental_scc.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ vi offline_incremental_scc(vector<array<int, 2>> eds,
1616
vi ids(n, -1), joins(m, m), idx(m), vs(n), scc_id;
1717
iota(all(idx), 0);
1818
vector<vi> g;
19-
auto dnc = [&](auto&& dnc, auto el, auto er, int tl,
19+
auto dnc = [&](this auto&& dnc, auto el, auto er, int tl,
2020
int tr) {
2121
g.clear();
2222
int mid = midpoint(tl, tr);
@@ -42,11 +42,11 @@ vi offline_incremental_scc(vector<array<int, 2>> eds,
4242
auto& [u, v] = eds[*it];
4343
u = scc_id[u], v = scc_id[v];
4444
}
45-
dnc(dnc, el, split, tl, mid);
46-
dnc(dnc, split, er, mid, tr);
45+
dnc(el, split, tl, mid);
46+
dnc(split, er, mid, tr);
4747
};
4848
// uses -1 as the lower bound to correctly handle
4949
// self-edges
50-
dnc(dnc, all(idx), -1, m);
50+
dnc(all(idx), -1, m);
5151
return joins;
5252
}

library/graphs/uncommon/bridges.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@
1818
auto bridges(const auto& g, int m) {
1919
int n = sz(g), num_ccs = 0, q = 0, s = 0;
2020
vi br_id(n, -1), is_br(m), tin(n), st(n);
21-
auto dfs = [&](auto&& dfs, int u, int p) -> int {
21+
auto dfs = [&](this auto&& dfs, int u, int p) -> int {
2222
int low = tin[u] = ++q;
2323
st[s++] = u;
2424
for (auto [v, e] : g[u])
2525
if (e != p && br_id[v] < 0)
26-
low = min(low, tin[v] ?: dfs(dfs, v, e));
26+
low = min(low, tin[v] ?: dfs(v, e));
2727
if (tin[u] == low) {
2828
if (p != -1) is_br[p] = 1;
2929
while (br_id[u] < 0) br_id[st[--s]] = num_ccs;
3030
num_ccs++;
3131
}
3232
return low;
3333
};
34-
rep(i, 0, n) if (!tin[i]) dfs(dfs, i, -1);
34+
rep(i, 0, n) if (!tin[i]) dfs(i, -1);
3535
return tuple{num_ccs, br_id, is_br};
3636
}

library/graphs/uncommon/cuts.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
auto cuts(const auto& g, int m) {
2020
int n = sz(g), num_bccs = 0, q = 0, s = 0;
2121
vi bcc_id(m, -1), is_cut(n), tin(n), st(m);
22-
auto dfs = [&](auto&& dfs, int u, int p) -> int {
22+
auto dfs = [&](this auto&& dfs, int u, int p) -> int {
2323
int low = tin[u] = ++q;
2424
for (auto [v, e] : g[u]) {
2525
assert(u != v);
2626
if (e == p) continue;
2727
if (tin[v] < tin[u]) st[s++] = e;
2828
int lu = -1;
29-
low = min(low, tin[v] ?: (lu = dfs(dfs, v, e)));
29+
low = min(low, tin[v] ?: (lu = dfs(v, e)));
3030
if (lu >= tin[u]) {
3131
is_cut[u] = p >= 0 || tin[u] + 1 < tin[v];
3232
while (bcc_id[e] < 0) bcc_id[st[--s]] = num_bccs;
@@ -35,6 +35,6 @@ auto cuts(const auto& g, int m) {
3535
}
3636
return low;
3737
};
38-
rep(i, 0, n) if (!tin[i]) dfs(dfs, i, -1);
38+
rep(i, 0, n) if (!tin[i]) dfs(i, -1);
3939
return tuple{num_bccs, bcc_id, is_cut};
4040
}

0 commit comments

Comments
 (0)