Skip to content

Commit 0cae55d

Browse files
committed
rename IIFE recursion parameter to self
Per convention, name the `this auto&&` recursion parameter of the unnamed IIFEs `self` (previously `dfs`/`dnc`). Updates the parameter and all recursive call sites within each of the 7 IIFEs. No behavior change.
1 parent 3a82239 commit 0cae55d

7 files changed

Lines changed: 17 additions & 17 deletions

File tree

library/convolution/min_plus_convolution_convex_and_arbitrary.hpp

Lines changed: 3 additions & 3 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-
[&](this auto&& dnc, int res_le, int res_ri, int arb_le,
12+
[&](this auto&& self, int res_le, int res_ri, int arb_le,
1313
int arb_ri) {
1414
if (res_le >= res_ri) return;
1515
int mid_res = (res_le + res_ri) / 2;
@@ -22,9 +22,9 @@ vi min_plus(const vi& convex, const vi& arbitrary) {
2222
op_arb = i;
2323
}
2424
}
25-
dnc(res_le, mid_res, arb_le, min(arb_ri, op_arb + 1));
25+
self(res_le, mid_res, arb_le, min(arb_ri, op_arb + 1));
2626
// NOLINTNEXTLINE(readability-suspicious-call-argument)
27-
dnc(mid_res + 1, res_ri, op_arb, arb_ri);
27+
self(mid_res + 1, res_ri, op_arb, arb_ri);
2828
}(0, n + m - 1, 0, m);
2929
return res;
3030
}

library/graphs/euler_path.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
vector<pii> euler_path(auto& g, int m, int s) {
1818
vi vis(m);
1919
vector<pii> path;
20-
[&](this auto&& dfs, int u, int eu) -> void {
20+
[&](this auto&& self, int u, int eu) -> void {
2121
while (!empty(g[u])) {
2222
auto [v, ev] = g[u].back();
2323
g[u].pop_back();
24-
if (!vis[ev]) vis[ev] = 1, dfs(v, ev);
24+
if (!vis[ev]) vis[ev] = 1, self(v, ev);
2525
}
2626
path.emplace_back(u, eu);
2727
}(s, -1);

library/graphs/strongly_connected_components/offline_incremental_scc.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ vi offline_incremental_scc(vector<array<int, 2>> eds,
1818
vector<vi> g;
1919
// uses -1 as the lower bound to correctly handle
2020
// self-edges
21-
[&](this auto&& dnc, auto el, auto er, int tl, int tr) {
21+
[&](this auto&& self, auto el, auto er, int tl, int tr) {
2222
g.clear();
2323
int mid = midpoint(tl, tr);
2424
for (auto it = el; it != er; it++) {
@@ -43,8 +43,8 @@ vi offline_incremental_scc(vector<array<int, 2>> eds,
4343
auto& [u, v] = eds[*it];
4444
u = scc_id[u], v = scc_id[v];
4545
}
46-
dnc(el, split, tl, mid);
47-
dnc(split, er, mid, tr);
46+
self(el, split, tl, mid);
47+
self(split, er, mid, tr);
4848
}(all(idx), -1, m);
4949
return joins;
5050
}

library/trees/centroid_decomp.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ vi cd(auto& g, auto f) {
1919
}
2020
return 2 * s[u] >= n ? s[p] = n - s[u], u : -1;
2121
};
22-
[&](this auto&& dfs, int u) -> int {
22+
[&](this auto&& self, int u) -> int {
2323
f(u = ctd(u, u, s[u]));
24-
for (int v : g[u]) erase(g[v], u), p[dfs(v)] = u;
24+
for (int v : g[u]) erase(g[v], u), p[self(v)] = u;
2525
return u;
2626
}(0);
2727
return p;

library/trees/edge_cd.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ template<class G> void edge_cd(vector<G>& g, auto f) {
2626
}
2727
return 2 * s[u] > m ? s[p] = m + 1 - s[u], u : -1;
2828
};
29-
[&](this auto&& dfs, int u, int m) {
29+
[&](this auto&& self, int u, int m) {
3030
if (m < 2) return;
3131
u = ctd(u, u, m);
3232
int sum = 0;
@@ -37,8 +37,8 @@ template<class G> void edge_cd(vector<G>& g, auto f) {
3737
f(u, it - begin(g[u]));
3838
G oth(it, end(g[u]));
3939
g[u].erase(it, end(g[u]));
40-
dfs(u, sum);
40+
self(u, sum);
4141
swap(g[u], oth);
42-
dfs(u, m - sum);
42+
self(u, m - sum);
4343
}(0, sz(g) - 1);
4444
};

library/trees/shallowest_decomp_tree.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
//! @space O(n)
1010
void shallowest(auto& g, auto f) {
1111
vector<vi> order(bit_width(size(g)));
12-
[&](this auto&& dfs, int u, int p) -> int {
12+
[&](this auto&& self, int u, int p) -> int {
1313
int once = 0, twice = 0;
1414
for (int v : g[u])
1515
if (v != p) {
16-
int dp = dfs(v, u);
16+
int dp = self(v, u);
1717
twice |= once & dp, once |= dp;
1818
}
1919
auto dp = (once | (bit_ceil(twice + 1u) - 1)) + 1;

library/trees/uncommon/subtree_isomorphism.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
auto subtree_iso(const auto& g) {
1313
vi iso_id(sz(g), -1);
1414
map<vi, int> hashes;
15-
[&](this auto&& dfs, int u, int p) -> int {
15+
[&](this auto&& self, int u, int p) -> int {
1616
vi ch_ids;
1717
for (int v : g[u])
18-
if (v != p) ch_ids.push_back(dfs(v, u));
18+
if (v != p) ch_ids.push_back(self(v, u));
1919
ranges::sort(ch_ids);
2020
return iso_id[u] =
2121
hashes.try_emplace(ch_ids, sz(hashes))

0 commit comments

Comments
 (0)