diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 9c545fc6..498be058 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -8,8 +8,9 @@ runs: wget https://apt.llvm.org/llvm.sh chmod +x llvm.sh sudo ./llvm.sh 22 - sudo apt-get update sudo apt-get install -y clang-format-22 clang-tidy-22 + sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100 clang-22 --version clang-format-22 --version clang-tidy-22 --version + g++ --version diff --git a/.github/workflows/programming_team_code_ci.yml b/.github/workflows/programming_team_code_ci.yml index 6bb0d909..ea82f942 100644 --- a/.github/workflows/programming_team_code_ci.yml +++ b/.github/workflows/programming_team_code_ci.yml @@ -12,6 +12,10 @@ jobs: - uses: actions/checkout@v1 - name: Set up Python uses: actions/setup-python@v1 + - name: Make preinstalled g++-14 the default g++ + run: | + sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100 + g++ --version - name: Install dependencies run: | pip install "setuptools<81" @@ -53,6 +57,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - name: Make preinstalled g++-14 the default g++ + run: | + sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100 + g++ --version - name: g++ with gcc run: make --directory=tests/ compile_gcc @@ -76,8 +84,8 @@ jobs: steps: - uses: actions/checkout@v4 - uses: ./.github/actions/setup - - name: Install texlive, rename, nodejs, npm - run: sudo apt install texlive texlive-latex-extra rename nodejs npm + - name: Install texlive, rename + run: sudo apt install texlive texlive-latex-extra rename - name: build pdf run: make --directory=tests/ build_pdf - uses: actions/upload-artifact@v4 @@ -127,6 +135,6 @@ jobs: steps: - uses: actions/checkout@v4 - name: Install dependencies - run: sudo apt install shfmt shellcheck + run: sudo apt install shfmt - name: shellcheck, shfmt run: make --directory=tests/ shellcheck_shfmt diff --git a/.verify-helper/config.toml b/.verify-helper/config.toml index 70d17462..7a9150b5 100644 --- a/.verify-helper/config.toml +++ b/.verify-helper/config.toml @@ -2,7 +2,7 @@ CXX = "g++" CXXFLAGS = [ "-O2", - "-std=c++20", + "-std=c++23", "-fsanitize=address,undefined", "-fno-sanitize-recover=all", "-fstack-protector", diff --git a/.verify-helper/timestamps.remote.json b/.verify-helper/timestamps.remote.json index 7a93c7f9..faf64fbb 100644 --- a/.verify-helper/timestamps.remote.json +++ b/.verify-helper/timestamps.remote.json @@ -30,7 +30,7 @@ "tests/library_checker_aizu_tests/data_structures/lazy_segment_tree_inc_constructor.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/data_structures/merge_sort_tree.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/data_structures/mode_query.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/data_structures/permutation_tree.test.cpp": "2026-07-06 13:10:16 -0700", +"tests/library_checker_aizu_tests/data_structures/permutation_tree.test.cpp": "2026-07-06 22:18:09 -0700", "tests/library_checker_aizu_tests/data_structures/persistent_queue_tree.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/data_structures/persistent_seg_tree.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/data_structures/pq_ds_undo_sliding_window.test.cpp": "2026-07-06 13:10:16 -0700", @@ -49,7 +49,7 @@ "tests/library_checker_aizu_tests/dsu/dsu_bipartite.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/dsu/dsu_weighted_aizu.test.cpp": "2026-07-06 13:49:19 -0700", "tests/library_checker_aizu_tests/dsu/dsu_weighted_lib_checker.test.cpp": "2026-07-06 13:49:19 -0700", -"tests/library_checker_aizu_tests/dsu/kruskal_tree_aizu.test.cpp": "2026-07-06 13:10:16 -0700", +"tests/library_checker_aizu_tests/dsu/kruskal_tree_aizu.test.cpp": "2026-07-06 22:18:09 -0700", "tests/library_checker_aizu_tests/dsu/line_tree_aizu.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/dsu/line_tree_lib_checker.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/dsu/range_parallel_dsu.test.cpp": "2026-07-06 13:10:16 -0700", @@ -62,7 +62,7 @@ "tests/library_checker_aizu_tests/graphs/biconnected_components.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/graphs/connected_components_of_complement_graph.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/graphs/dijkstra_aizu.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/graphs/dijkstra_lib_checker.test.cpp": "2026-07-06 13:10:16 -0700", +"tests/library_checker_aizu_tests/graphs/dijkstra_lib_checker.test.cpp": "2026-07-06 22:18:09 -0700", "tests/library_checker_aizu_tests/graphs/directed_cycle.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/graphs/enumerate_triangles.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/graphs/euler_walk_directed.test.cpp": "2026-07-06 13:10:16 -0700", @@ -74,11 +74,11 @@ "tests/library_checker_aizu_tests/graphs/strongly_connected_components_aizu.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/graphs/strongly_connected_components_lib_checker.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/graphs/two_edge_components.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/handmade_tests/count_paths.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/handmade_tests/dsu.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/handmade_tests/edge_cd_small_trees.test.cpp": "2026-07-06 13:10:16 -0700", +"tests/library_checker_aizu_tests/handmade_tests/count_paths.test.cpp": "2026-07-06 22:18:09 -0700", +"tests/library_checker_aizu_tests/handmade_tests/dsu.test.cpp": "2026-07-06 22:18:09 -0700", +"tests/library_checker_aizu_tests/handmade_tests/edge_cd_small_trees.test.cpp": "2026-07-06 22:18:09 -0700", "tests/library_checker_aizu_tests/handmade_tests/fib_matrix_expo.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/handmade_tests/functional_graph.test.cpp": "2026-07-06 13:10:16 -0700", +"tests/library_checker_aizu_tests/handmade_tests/functional_graph.test.cpp": "2026-07-06 22:43:37 -0700", "tests/library_checker_aizu_tests/handmade_tests/hilbert_mos.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/handmade_tests/kd_bit.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/handmade_tests/kth_par.test.cpp": "2026-07-06 13:10:16 -0700", @@ -92,7 +92,7 @@ "tests/library_checker_aizu_tests/handmade_tests/sa_find_subarray.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/handmade_tests/seg_tree_find.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/handmade_tests/seg_tree_find_small.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/handmade_tests/seg_tree_midpoint.test.cpp": "2026-07-06 13:10:16 -0700", +"tests/library_checker_aizu_tests/handmade_tests/seg_tree_midpoint.test.cpp": "2026-07-06 22:18:09 -0700", "tests/library_checker_aizu_tests/handmade_tests/xor_basis_walk.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/loops/chooses.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/loops/quotients.test.cpp": "2026-07-06 13:10:16 -0700", @@ -132,11 +132,11 @@ "tests/library_checker_aizu_tests/strings/suffix_array_short.test.cpp": "2026-04-12 06:15:25 -0600", "tests/library_checker_aizu_tests/strings/trie.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/strings/wildcard_pattern_matching.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/trees/cd_count_paths_per_length.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/trees/edge_cd_contour_range_query.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/trees/edge_cd_contour_range_update.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/trees/edge_cd_count_paths_per_length.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/trees/edge_cd_reroot_dp.test.cpp": "2026-07-06 13:10:16 -0700", +"tests/library_checker_aizu_tests/trees/cd_count_paths_per_length.test.cpp": "2026-07-06 22:18:09 -0700", +"tests/library_checker_aizu_tests/trees/edge_cd_contour_range_query.test.cpp": "2026-07-06 22:43:37 -0700", +"tests/library_checker_aizu_tests/trees/edge_cd_contour_range_update.test.cpp": "2026-07-06 22:43:37 -0700", +"tests/library_checker_aizu_tests/trees/edge_cd_count_paths_per_length.test.cpp": "2026-07-06 22:18:09 -0700", +"tests/library_checker_aizu_tests/trees/edge_cd_reroot_dp.test.cpp": "2026-07-06 22:18:09 -0700", "tests/library_checker_aizu_tests/trees/hld_aizu1.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/trees/hld_aizu2.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/trees/hld_lib_checker_path.test.cpp": "2026-07-06 13:10:16 -0700", @@ -148,7 +148,7 @@ "tests/library_checker_aizu_tests/trees/kth_path_tree_lift.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/trees/lca_all_methods_aizu.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/trees/lca_all_methods_lib_checker.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/trees/shallowest_aizu_tree_height.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/trees/shallowest_lib_checker_tree_path_composite.test.cpp": "2026-07-06 13:10:16 -0700", +"tests/library_checker_aizu_tests/trees/shallowest_aizu_tree_height.test.cpp": "2026-07-06 22:18:09 -0700", +"tests/library_checker_aizu_tests/trees/shallowest_lib_checker_tree_path_composite.test.cpp": "2026-07-06 22:18:09 -0700", "tests/library_checker_aizu_tests/trees/subtree_isomorphism.test.cpp": "2026-07-06 13:10:16 -0700" } \ No newline at end of file diff --git a/tests/.config/.clang-format b/tests/.config/.clang-format index 3e0e6471..f6f61298 100644 --- a/tests/.config/.clang-format +++ b/tests/.config/.clang-format @@ -88,5 +88,5 @@ SpacesInCStyleCastParentheses: false SpacesInContainerLiterals: false SpacesInParentheses: false SpacesInSquareBrackets: false -Standard: c++20 +Standard: Latest ... diff --git a/tests/.config/.gcc_compile_flags b/tests/.config/.gcc_compile_flags index 5babab28..86d4448d 100644 --- a/tests/.config/.gcc_compile_flags +++ b/tests/.config/.gcc_compile_flags @@ -10,4 +10,4 @@ -Wduplicated-cond -Werror -O2 --std=c++20 +-std=c++23 diff --git a/tests/Makefile b/tests/Makefile index a8342938..cd130f8d 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,9 +1,9 @@ help: @echo "command | explanation" @echo "------------------------------------ | -----------" - @echo "make compile_gcc | compile all tests with -std=c++20 for warnings" + @echo "make compile_gcc | compile all tests with -std=c++23 for warnings" @echo " |" - @echo "make compile_clang | compile all tests with clang, -std=c++20 for warnings" + @echo "make compile_clang | compile all tests with clang, -std=c++23 for warnings" @echo " |" @echo "make grep_clangformat_cppcheck | various greps to catch certain things, clang-format, cppcheck" @echo " |" diff --git a/tests/library_checker_aizu_tests/cd_asserts.hpp b/tests/library_checker_aizu_tests/cd_asserts.hpp index 7f42fbde..ac9d7e34 100644 --- a/tests/library_checker_aizu_tests/cd_asserts.hpp +++ b/tests/library_checker_aizu_tests/cd_asserts.hpp @@ -5,16 +5,16 @@ void cd_asserts(vector adj) { vi naive_par_decomp(sz(adj), -1); vi par = cd(adj, [&](int cent) -> void { assert(decomp_size[cent] == -1); - auto dfs = [&](auto&& self, int u, int p) -> int { + auto dfs = [&](this auto&& self, int u, int p) -> int { if (p != -1) naive_par_decomp[u] = cent; int sub_size = 1; for (int v : adj[u]) - if (v != p) sub_size += self(self, v, u); + if (v != p) sub_size += self(v, u); return sub_size; }; - decomp_size[cent] = dfs(dfs, cent, -1); + decomp_size[cent] = dfs(cent, -1); for (int u : adj[cent]) { - int sz_subtree = dfs(dfs, u, cent); + int sz_subtree = dfs(u, cent); assert(1 <= sz_subtree && 2 * sz_subtree <= decomp_size[cent]); } diff --git a/tests/library_checker_aizu_tests/data_structures/permutation_tree.test.cpp b/tests/library_checker_aizu_tests/data_structures/permutation_tree.test.cpp index a9d903aa..fcb1c586 100644 --- a/tests/library_checker_aizu_tests/data_structures/permutation_tree.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/permutation_tree.test.cpp @@ -15,7 +15,7 @@ int main() { cout << sz(ch) << '\n'; int curr_time = 0; vi node_to_time(sz(ch), -1); - auto dfs = [&](auto&& self, int u, int p) -> void { + auto dfs = [&](this auto&& self, int u, int p) -> void { node_to_time[u] = curr_time++; cout << (p == -1 ? p : node_to_time[p]) << " " << pt.p[u].mn_idx << " " @@ -23,8 +23,8 @@ int main() { << (pt.p[u].is_join || empty(ch[u]) ? "linear" : "prime") << '\n'; - for (int v : ch[u]) self(self, v, u); + for (int v : ch[u]) self(v, u); }; - dfs(dfs, root, -1); + dfs(root, -1); return 0; } diff --git a/tests/library_checker_aizu_tests/dsu/kruskal_tree_aizu.test.cpp b/tests/library_checker_aizu_tests/dsu/kruskal_tree_aizu.test.cpp index 53fdf18c..fbf8852b 100644 --- a/tests/library_checker_aizu_tests/dsu/kruskal_tree_aizu.test.cpp +++ b/tests/library_checker_aizu_tests/dsu/kruskal_tree_aizu.test.cpp @@ -30,14 +30,14 @@ int main() { rep(i, n, kt.id) mst_sum += weight[i]; vi depth(2 * n); vi actual_par(2 * n, -1); - auto dfs = [&](auto&& self, int v) -> void { + auto dfs = [&](this auto&& self, int v) -> void { for (int u : kt.g[v]) { depth[u] = 1 + depth[v]; actual_par[u] = v; - self(self, u); + self(u); } }; - dfs(dfs, kt.id - 1); + dfs(kt.id - 1); rep(i, 0, n) rep(j, i + 1, n) { int u = i, v = j; while (u != v) diff --git a/tests/library_checker_aizu_tests/edge_cd_asserts.hpp b/tests/library_checker_aizu_tests/edge_cd_asserts.hpp index 9978e108..bb3d197c 100644 --- a/tests/library_checker_aizu_tests/edge_cd_asserts.hpp +++ b/tests/library_checker_aizu_tests/edge_cd_asserts.hpp @@ -1,19 +1,19 @@ #pragma once auto edge_cd_asserts = [&](int cent, int split) -> void { assert(0 < split && split < sz(adj[cent])); - auto dfs = [&](auto&& self, int u, int p) -> int { + auto dfs = [&](this auto&& self, int u, int p) -> int { int siz = 1; for (int v : adj[u]) - if (v != p) siz += self(self, v, u); + if (v != p) siz += self(v, u); return siz; }; - int sz_all = dfs(dfs, cent, -1); + int sz_all = dfs(cent, -1); assert(sz_all >= 3); array cnts = {0, 0}; array max_cnt = {0, 0}; array number_of_cnts = {0, 0}; rep(i, 0, sz(adj[cent])) { - int sz_subtree = dfs(dfs, adj[cent][i], cent); + int sz_subtree = dfs(adj[cent][i], cent); assert(2 * sz_subtree <= sz_all); cnts[i < split] += sz_subtree; max_cnt[i < split] = diff --git a/tests/library_checker_aizu_tests/graphs/dijkstra_lib_checker.test.cpp b/tests/library_checker_aizu_tests/graphs/dijkstra_lib_checker.test.cpp index 88f09996..67e71d8a 100644 --- a/tests/library_checker_aizu_tests/graphs/dijkstra_lib_checker.test.cpp +++ b/tests/library_checker_aizu_tests/graphs/dijkstra_lib_checker.test.cpp @@ -26,13 +26,13 @@ int main() { vector vis(n); vis[t] = 1; vector> path; - auto dfs = [&](auto&& self, int u) -> bool { + auto dfs = [&](this auto&& self, int u) -> bool { if (u == s) return 1; for (auto [v, w] : adj_inv[u]) { if (!vis[v] && len[v] != LLONG_MAX && len[v] + w == len[u]) { vis[v] = 1; - if (self(self, v)) { + if (self(v)) { path.push_back({v, u}); return 1; } @@ -40,7 +40,7 @@ int main() { } return 0; }; - assert(dfs(dfs, t)); + assert(dfs(t)); cout << len[t] << " " << sz(path) << '\n'; for (auto [u, v] : path) cout << u << " " << v << '\n'; return 0; diff --git a/tests/library_checker_aizu_tests/handmade_tests/count_paths.test.cpp b/tests/library_checker_aizu_tests/handmade_tests/count_paths.test.cpp index 9425f11e..1ccb44ed 100644 --- a/tests/library_checker_aizu_tests/handmade_tests/count_paths.test.cpp +++ b/tests/library_checker_aizu_tests/handmade_tests/count_paths.test.cpp @@ -19,7 +19,7 @@ vector count_paths_per_node(vector adj, int k) { vector num_paths(sz(adj)); cd(adj, [&](int cent) { vector pre_d{1}, cur_d{0}; - auto dfs = [&](auto&& self, int u, int p, + auto dfs = [&](this auto&& self, int u, int p, int d) -> ll { if (d > k) return 0LL; if (sz(cur_d) <= d) cur_d.push_back(0); @@ -27,12 +27,12 @@ vector count_paths_per_node(vector adj, int k) { ll cnt = 0; if (k - d < sz(pre_d)) cnt += pre_d[k - d]; for (int c : adj[u]) - if (c != p) cnt += self(self, c, u, d + 1); + if (c != p) cnt += self(c, u, d + 1); num_paths[u] += cnt; return cnt; }; auto dfs_child = [&](int child) -> ll { - ll cnt = dfs(dfs, child, cent, 1); + ll cnt = dfs(child, cent, 1); pre_d.resize(sz(cur_d)); for (int i = 1; i < sz(cur_d) && cur_d[i]; i++) pre_d[i] += cur_d[i], cur_d[i] = 0; @@ -72,15 +72,15 @@ vector count_paths_per_length(vector adj) { if (sz(adj) >= 2) num_paths[1] = sz(adj) - 1; edge_cd(adj, [&](int cent, int split) { vector> cnt(2, vector(1)); - auto dfs = [&](auto&& self, int u, int p, int d, + auto dfs = [&](this auto&& self, int u, int p, int d, int side) -> void { if (sz(cnt[side]) == d) cnt[side].push_back(0.0); cnt[side][d]++; for (int c : adj[u]) - if (c != p) self(self, c, u, 1 + d, side); + if (c != p) self(c, u, 1 + d, side); }; rep(i, 0, sz(adj[cent])) - dfs(dfs, adj[cent][i], cent, 1, i < split); + dfs(adj[cent][i], cent, 1, i < split); vector prod = conv(cnt[0], cnt[1]); rep(i, 0, sz(prod)) num_paths[i] += llround(prod[i]); }); diff --git a/tests/library_checker_aizu_tests/handmade_tests/dsu.test.cpp b/tests/library_checker_aizu_tests/handmade_tests/dsu.test.cpp index 5839d470..64351bb4 100644 --- a/tests/library_checker_aizu_tests/handmade_tests/dsu.test.cpp +++ b/tests/library_checker_aizu_tests/handmade_tests/dsu.test.cpp @@ -14,16 +14,16 @@ int main() { bool joined = dsu.join(u, v); { vector vis(n); - auto dfs = [&](auto&& self, int v) -> void { + auto dfs = [&](this auto&& self, int v) -> void { for (int u : adj[v]) { if (!vis[u]) { vis[u] = 1; - self(self, u); + self(u); } } }; vis[u] = 1; - dfs(dfs, u); + dfs(u); assert(vis[v] != joined); } adj[u].push_back(v); @@ -31,17 +31,17 @@ int main() { rep(i, 0, n) { vector vis(n); int cnt_nodes = 0; - auto dfs = [&](auto&& self, int v) -> void { + auto dfs = [&](this auto&& self, int v) -> void { cnt_nodes++; for (int u : adj[v]) { if (!vis[u]) { vis[u] = 1; - self(self, u); + self(u); } } }; vis[i] = 1; - dfs(dfs, i); + dfs(i); assert(cnt_nodes == dsu.size(i)); } } diff --git a/tests/library_checker_aizu_tests/handmade_tests/seg_tree_midpoint.test.cpp b/tests/library_checker_aizu_tests/handmade_tests/seg_tree_midpoint.test.cpp index 74bee735..c05fdc62 100644 --- a/tests/library_checker_aizu_tests/handmade_tests/seg_tree_midpoint.test.cpp +++ b/tests/library_checker_aizu_tests/handmade_tests/seg_tree_midpoint.test.cpp @@ -6,7 +6,7 @@ int lg(int x) { return bit_width(x + 0u) - 1; } int main() { cin.tie(0)->sync_with_stdio(0); rep(n, 1, 5000) { - auto dfs = [&](auto&& self, int tl, int tr, + auto dfs = [&](this auto&& self, int tl, int tr, int v) -> void { assert((v >= n) == ((tr - tl) == 1)); if (v >= n) { // leaf node @@ -58,11 +58,11 @@ int main() { assert(split(tl - 1234, tr - 1234) == tm - 1234); assert(split(tl - 1, tr - 1) == tm - 1); assert(split(tl + 50, tr + 50) == tm + 50); - self(self, tl, tm, 2 * v); - self(self, tm, tr, 2 * v + 1); + self(tl, tm, 2 * v); + self(tm, tr, 2 * v + 1); } }; - dfs(dfs, 0, n, 1); + dfs(0, n, 1); } cout << "Hello World\n"; return 0; diff --git a/tests/library_checker_aizu_tests/trees/edge_cd_count_paths_per_length.test.cpp b/tests/library_checker_aizu_tests/trees/edge_cd_count_paths_per_length.test.cpp index 0d439628..ea1d0b65 100644 --- a/tests/library_checker_aizu_tests/trees/edge_cd_count_paths_per_length.test.cpp +++ b/tests/library_checker_aizu_tests/trees/edge_cd_count_paths_per_length.test.cpp @@ -14,15 +14,15 @@ vector count_paths_per_length(vector adj) { if (sz(adj) >= 2) num_paths[1] = sz(adj) - 1; edge_cd(adj, [&](int cent, int split) { vector> cnt(2, vector(1)); - auto dfs = [&](auto&& self, int u, int p, int d, + auto dfs = [&](this auto&& self, int u, int p, int d, int side) -> void { if (sz(cnt[side]) == d) cnt[side].push_back(0.0); cnt[side][d]++; for (int c : adj[u]) - if (c != p) self(self, c, u, 1 + d, side); + if (c != p) self(c, u, 1 + d, side); }; rep(i, 0, sz(adj[cent])) - dfs(dfs, adj[cent][i], cent, 1, i < split); + dfs(adj[cent][i], cent, 1, i < split); vector prod = conv(cnt[0], cnt[1]); rep(i, 0, sz(prod)) num_paths[i] += llround(prod[i]); }); diff --git a/tests/library_checker_aizu_tests/trees/edge_cd_reroot_dp.test.cpp b/tests/library_checker_aizu_tests/trees/edge_cd_reroot_dp.test.cpp index e75bce8e..a40938a1 100644 --- a/tests/library_checker_aizu_tests/trees/edge_cd_reroot_dp.test.cpp +++ b/tests/library_checker_aizu_tests/trees/edge_cd_reroot_dp.test.cpp @@ -31,12 +31,11 @@ int main() { res[u] = (res[u] + 1LL * b[i] * a[v] + c[i]) % mod; res[v] = (res[v] + 1LL * b[i] * a[u] + c[i]) % mod; } - auto dfs = [&](auto&& self, int u) -> void { + auto dfs = [&](this auto&& self, int u) -> void { for (auto [v, e_id] : adj_with_id[u]) - if (v != par[u].first) - par[v] = {u, e_id}, self(self, v); + if (v != par[u].first) par[v] = {u, e_id}, self(v); }; - dfs(dfs, 0); + dfs(0); } auto edge_id = [&](int u, int v) -> int { bool u_low = (par[u].first == v); @@ -48,7 +47,7 @@ int main() { array>, 2> all_backwards; array sum_forward = {0, 0}; array cnt_nodes = {0, 0}; - auto dfs = [&](auto&& self, int u, int p, + auto dfs = [&](this auto&& self, int u, int p, array forwards, array backwards, int side) -> void { @@ -73,12 +72,12 @@ int main() { int(1LL * backwards[0] * b[e_id] % mod), int((1LL * backwards[1] * b[e_id] + c[e_id]) % mod)}; - self(self, v, u, curr_forw, curr_backw, side); + self(v, u, curr_forw, curr_backw, side); } }; rep(i, 0, sz(adj[cent])) { int e_id = edge_id(cent, adj[cent][i]); - dfs(dfs, adj[cent][i], cent, {b[e_id], c[e_id]}, + dfs(adj[cent][i], cent, {b[e_id], c[e_id]}, {b[e_id], c[e_id]}, i < split); } rep(side, 0, 2) for (auto [u, curr_b, curr_c] : diff --git a/tests/library_checker_aizu_tests/trees/shallowest_aizu_tree_height.test.cpp b/tests/library_checker_aizu_tests/trees/shallowest_aizu_tree_height.test.cpp index c0826c11..af9ded81 100644 --- a/tests/library_checker_aizu_tests/trees/shallowest_aizu_tree_height.test.cpp +++ b/tests/library_checker_aizu_tests/trees/shallowest_aizu_tree_height.test.cpp @@ -20,24 +20,23 @@ int main() { shallowest(adj, [&](int cent) { int lowest = 0; int curr_lowest = 0; - auto dfs = [&](auto&& self, int v, int p, + auto dfs = [&](this auto&& self, int v, int p, int height) -> void { res[v] = max(res[v], height + lowest); res[cent] = max(res[cent], height); curr_lowest = max(curr_lowest, height); for (int u : adj[v]) - if (u != p) - self(self, u, v, height + weight[{u, v}]); + if (u != p) self(u, v, height + weight[{u, v}]); }; for (int v : adj[cent]) { curr_lowest = 0; - dfs(dfs, v, cent, weight[{v, cent}]); + dfs(v, cent, weight[{v, cent}]); lowest = max(lowest, curr_lowest); } lowest = 0; for (int v : adj[cent] | views::reverse) { curr_lowest = 0; - dfs(dfs, v, cent, weight[{v, cent}]); + dfs(v, cent, weight[{v, cent}]); lowest = max(lowest, curr_lowest); } }); diff --git a/tests/library_checker_aizu_tests/trees/shallowest_lib_checker_tree_path_composite.test.cpp b/tests/library_checker_aizu_tests/trees/shallowest_lib_checker_tree_path_composite.test.cpp index 5c723edf..de39e82c 100644 --- a/tests/library_checker_aizu_tests/trees/shallowest_lib_checker_tree_path_composite.test.cpp +++ b/tests/library_checker_aizu_tests/trees/shallowest_lib_checker_tree_path_composite.test.cpp @@ -33,7 +33,7 @@ int main() { int total_cnt_nodes = 0; int curr_sum_evaluated = 0; int curr_cnt_nodes = 0; - auto dfs = [&](auto&& self, int v, int p, + auto dfs = [&](this auto&& self, int v, int p, line downwards, line upwards, bool forwards) -> void { // f(x) + f(y) + f(z) = b*x+c + b*y+c + b*z+c = @@ -60,14 +60,14 @@ int main() { int u = adj[v][i]; line curr_line = weight[v][i]; if (u != p) - self(self, u, v, compose(downwards, curr_line), + self(u, v, compose(downwards, curr_line), compose(curr_line, upwards), forwards); } }; rep(i, 0, sz(adj[cent])) { curr_sum_evaluated = 0; curr_cnt_nodes = 0; - dfs(dfs, adj[cent][i], cent, weight[cent][i], + dfs(adj[cent][i], cent, weight[cent][i], weight[cent][i], 1); total_sum_evaluated = (total_sum_evaluated + curr_sum_evaluated) % mod; @@ -78,7 +78,7 @@ int main() { for (int i = sz(adj[cent]) - 1; i >= 0; i--) { curr_sum_evaluated = 0; curr_cnt_nodes = 0; - dfs(dfs, adj[cent][i], cent, weight[cent][i], + dfs(adj[cent][i], cent, weight[cent][i], weight[cent][i], 0); total_sum_evaluated = (total_sum_evaluated + curr_sum_evaluated) % mod; diff --git a/tests/scripts/clangtidy.sh b/tests/scripts/clangtidy.sh index cc4b5c4d..a0458b06 100755 --- a/tests/scripts/clangtidy.sh +++ b/tests/scripts/clangtidy.sh @@ -9,5 +9,5 @@ git submodule init git submodule update find library_checker_aizu_tests/ -type f -name "*.test.cpp" | - parallel clang-tidy-22 --config-file=.config/.clang-tidy {} -- -std=c++20 || + parallel clang-tidy-22 --config-file=.config/.clang-tidy {} -- -std=c++23 || exit 1 diff --git a/tests/scripts/compile_clang.sh b/tests/scripts/compile_clang.sh index 02565f3c..c03e3287 100755 --- a/tests/scripts/compile_clang.sh +++ b/tests/scripts/compile_clang.sh @@ -9,4 +9,4 @@ git submodule init git submodule update find library_checker_aizu_tests/ -type f -name "*.test.cpp" | - parallel clang++-22 {} "$(tr '\n' ' ' <.config/.clang_compile_flags)" -std=c++20 + parallel clang++-22 {} "$(tr '\n' ' ' <.config/.clang_compile_flags)" -std=c++23 diff --git a/tests/scripts/compile_commented_snippets.sh b/tests/scripts/compile_commented_snippets.sh index c9796322..a01e6669 100755 --- a/tests/scripts/compile_commented_snippets.sh +++ b/tests/scripts/compile_commented_snippets.sh @@ -36,7 +36,7 @@ git submodule update } >entire_library.cpp echo "compiling code in @code ... @endcode comments with g++" -g++ -std=c++20 entire_library.cpp || exit 1 +g++ -std=c++23 entire_library.cpp || exit 1 echo "compiling code in @code ... @endcode comments with clang++" -clang++-22 -std=c++20 entire_library.cpp || exit 1 +clang++-22 -std=c++23 entire_library.cpp || exit 1 diff --git a/tests/scripts/grep_clangformat_cppcheck.sh b/tests/scripts/grep_clangformat_cppcheck.sh index ddf20644..353b9935 100755 --- a/tests/scripts/grep_clangformat_cppcheck.sh +++ b/tests/scripts/grep_clangformat_cppcheck.sh @@ -46,6 +46,6 @@ git submodule init git submodule update cppcheck --enable=all --inconclusive --suppressions-list=.config/.cppcheck_suppression_list \ - --force --language=c++ --error-exitcode=1 --std=c++20 --max-ctu-depth=50 \ + --force --language=c++ --error-exitcode=1 --std=c++23 --max-ctu-depth=50 \ library_checker_aizu_tests/**/*.hpp library_checker_aizu_tests/**/*.test.cpp ../library/**/*.hpp ../library/**/*.cpp || exit 1