Skip to content

Commit b3963aa

Browse files
authored
missed spot
Updated lambda function parameters to use rvalue references for better performance.
1 parent e1e26be commit b3963aa

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

library/trees/hld.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ template<bool VALS_EDGES> struct HLD {
1616
vi p, siz, rt, tin;
1717
HLD(auto& g): n(sz(g)), p(n), siz(n, 1), rt(n), tin(n) {
1818
// pass-self, not deducing this: gcc bug 118291
19-
auto dfs1 = [&](auto dfs1, int u) -> void {
19+
auto dfs1 = [&](auto&& dfs1, int u) -> void {
2020
for (int& v : g[u]) {
2121
erase(g[v], p[v] = u);
2222
dfs1(dfs1, v);
@@ -26,7 +26,7 @@ template<bool VALS_EDGES> struct HLD {
2626
};
2727
dfs1(dfs1, 0);
2828
int tim = 0;
29-
auto dfs2 = [&](auto dfs2, int u) -> void {
29+
auto dfs2 = [&](auto&& dfs2, int u) -> void {
3030
tin[u] = tim++;
3131
for (int v : g[u]) {
3232
rt[v] = (v == g[u][0] ? rt[u] : v);

0 commit comments

Comments
 (0)