Skip to content

Commit f9bf7d9

Browse files
committed
dont pass lambdas by const reference - following style in GCC
1 parent 97e9b4b commit f9bf7d9

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

library/data_structures/dsu/range_parallel_dsu.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
struct rp_dsu {
99
vector<UF> ufs;
1010
rp_dsu(int n): ufs(bit_width(unsigned(n)), UF(n)) {}
11-
void join(int l1, int l2, int len, const auto& f) {
11+
void join(int l1, int l2, int len, auto f) {
1212
if (len == 0) return;
1313
int lg = __lg(len);
1414
join_impl(lg, l1, l2, f);
1515
join_impl(lg, l1 + len - (1 << lg),
1616
l2 + len - (1 << lg), f);
1717
}
18-
void join_impl(int lvl, int u, int v, const auto& f) {
18+
void join_impl(int lvl, int u, int v, auto f) {
1919
if (lvl == 0) {
2020
u = ufs[0].find(u);
2121
v = ufs[0].find(v);

library/data_structures/seg_tree_uncommon/find_first.hpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,20 @@
2525
//! such element exists then `r` is returned
2626
//! @time O(log(n))
2727
//! @space O(log(n)) for recursion stack
28-
int find_first(int l, int r, const auto& f) {
28+
int find_first(int l, int r, auto f) {
2929
return find_first_in_range(l, r, f, 0, n, 1);
3030
}
3131
//! invariant: f(tree[v], tl, tr) is 1
32-
int find_first_in_subtree(const auto& f, int tl, int tr,
33-
int v) {
32+
int find_first_in_subtree(auto f, int tl, int tr, int v) {
3433
if (v >= n) return tl;
3534
int tm = split(tl, tr);
3635
push(tl, tm, tr, v);
3736
if (f(tree[2 * v], tl, tm))
3837
return find_first_in_subtree(f, tl, tm, 2 * v);
3938
return find_first_in_subtree(f, tm, tr, 2 * v + 1);
4039
}
41-
int find_first_in_range(int l, int r, const auto& f,
42-
int tl, int tr, int v) {
40+
int find_first_in_range(int l, int r, auto f, int tl,
41+
int tr, int v) {
4342
if (r <= tl || tr <= l) return r;
4443
if (l <= tl && tr <= r)
4544
return f(tree[v], tl, tr)

library/data_structures/seg_tree_uncommon/find_last.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,19 @@
2525
//! such element exists then (l - 1) is returned
2626
//! @time O(log(n))
2727
//! @space O(log(n)) for recursion stack
28-
int find_last(int l, int r, const auto& f) {
28+
int find_last(int l, int r, auto f) {
2929
return find_last_in_range(l, r, f, 0, n, 1);
3030
}
3131
//! invariant: f(tree[v], tl, tr) is 1
32-
int find_last_in_subtree(const auto& f, int tl, int tr,
33-
int v) {
32+
int find_last_in_subtree(auto f, int tl, int tr, int v) {
3433
if (v >= n) return tl;
3534
int tm = split(tl, tr);
3635
push(tl, tm, tr, v);
3736
if (f(tree[2 * v + 1], tm, tr))
3837
return find_last_in_subtree(f, tm, tr, 2 * v + 1);
3938
return find_last_in_subtree(f, tl, tm, 2 * v);
4039
}
41-
int find_last_in_range(int l, int r, const auto& f, int tl,
40+
int find_last_in_range(int l, int r, auto f, int tl,
4241
int tr, int v) {
4342
if (r <= tl || tr <= l) return l - 1;
4443
if (l <= tl && tr <= r)

library/monotonic_stack/monotonic_stack.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//! a[le[i]] < a[i]
88
//! @time O(n)
99
//! @space O(n)
10-
vi mono_st(const auto& a, const auto& cmp) {
10+
vi mono_st(const auto& a, auto cmp) {
1111
vi l(sz(a));
1212
rep(i, 0, sz(a)) for (l[i] = i - 1;
1313
l[i] >= 0 && !cmp(a[l[i]], a[i]);) l[i] = l[l[i]];

0 commit comments

Comments
 (0)