From 2a2d188d21adee013093ad36ad2ea24f4a98b2c1 Mon Sep 17 00:00:00 2001 From: TB Schardl Date: Sun, 24 Jan 2021 15:14:22 +0000 Subject: [PATCH] Fix uses of structured bindings to conform to C++17 standard and appease Clang. For discussion on this topic, see https://stackoverflow.com/questions/46114214/lambda-implicit-capture-fails-with-variable-declared-from-structured-binding. --- .../StronglyConnectedComponents.h | 8 +++-- sage/sage_io.h | 32 ++++++++++++++----- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/benchmarks/StronglyConnectedComponents/BGSS16-Filtering/StronglyConnectedComponents.h b/benchmarks/StronglyConnectedComponents/BGSS16-Filtering/StronglyConnectedComponents.h index 83dfec0af..b81b9306a 100644 --- a/benchmarks/StronglyConnectedComponents/BGSS16-Filtering/StronglyConnectedComponents.h +++ b/benchmarks/StronglyConnectedComponents/BGSS16-Filtering/StronglyConnectedComponents.h @@ -435,8 +435,10 @@ inline sequence StronglyConnectedComponents(Graph& GA, double beta = auto centers_copy = centers; size_t centers_size = centers.size(); auto in_f = vertexSubset(n, centers_size, centers.to_array()); - auto [in_table, in_elts] = + auto [in_table_sb, in_elts_sb] = multi_search(PG, labels, bits, in_f, cur_label_offset, in_edges); + auto in_table = in_table_sb; + auto in_elts = in_elts_sb; std::cout << "Finished in search" << "\n"; // in_table.analyze(); @@ -444,7 +446,9 @@ inline sequence StronglyConnectedComponents(Graph& GA, double beta = timer outs; outs.start(); auto out_f = vertexSubset(n, centers_size, centers_copy.to_array()); - auto [out_table, out_elts] = multi_search(PG, labels, bits, out_f, cur_label_offset); + auto [out_table_sb, out_elts_sb] = multi_search(PG, labels, bits, out_f, cur_label_offset); + auto out_table = out_table_sb; + auto out_elts = out_elts_sb; std::cout << "in_table, m = " << in_table.m << " ne = " << in_table.ne << "\n"; std::cout << "out_table, m = " << out_table.m << " ne = " << out_table.ne diff --git a/sage/sage_io.h b/sage/sage_io.h index 38b9eb107..7a0e4cb40 100644 --- a/sage/sage_io.h +++ b/sage/sage_io.h @@ -90,8 +90,12 @@ std::pair mmap_pmem(const char* filename) { template symmetric_graph read_compressed_symmetric_graph(const char* f1, const char* f2) { - auto [s0, s0_size] = mmap_pmem(f1); - auto [s1, s1_size] = mmap_pmem(f2); + auto [s0_sb, s0_size_sb] = mmap_pmem(f1); + auto [s1_sb, s1_size_sb] = mmap_pmem(f2); + auto s0 = s0_sb; + auto s0_size = s0_size_sb; + auto s1 = s1_sb; + auto s1_size = s1_size_sb; if (s0_size != s1_size) { std::cout << f1 << " and " << f2 << " have different file lengths, aborting" << std::endl; exit(-1); @@ -130,8 +134,12 @@ read_compressed_symmetric_graph(const char* f1, const char* f2) { template asymmetric_graph read_compressed_asymmetric_graph(const char* f1, const char* f2) { - auto [s0, s0_size] = mmap_pmem(f1); - auto [s1, s1_size] = mmap_pmem(f2); + auto [s0_sb, s0_size_sb] = mmap_pmem(f1); + auto [s1_sb, s1_size_sb] = mmap_pmem(f2); + auto s0 = s0_sb; + auto s0_size = s0_size_sb; + auto s1 = s1_sb; + auto s1_size = s1_size_sb; if (s0_size != s1_size) { std::cout << f1 << " and " << f2 << " have different file lengths, aborting" << std::endl; exit(-1); @@ -185,8 +193,12 @@ read_compressed_asymmetric_graph(const char* f1, const char* f2) { template symmetric_graph read_symmetric_binary_graph(const char* f1, const char* f2) { - auto [s0, s0_size] = mmap_pmem(f1); - auto [s1, s1_size] = mmap_pmem(f2); + auto [s0_sb, s0_size_sb] = mmap_pmem(f1); + auto [s1_sb, s1_size_sb] = mmap_pmem(f2); + auto s0 = s0_sb; + auto s0_size = s0_size_sb; + auto s1 = s1_sb; + auto s1_size = s1_size_sb; if (s0_size != s1_size) { std::cout << f1 << " and " << f2 << " have different file lengths, aborting" << std::endl; exit(-1); @@ -225,8 +237,12 @@ read_symmetric_binary_graph(const char* f1, const char* f2) { template asymmetric_graph read_asymmetric_binary_graph(const char* f1, const char* f2) { - auto [s0, s0_size] = mmap_pmem(f1); - auto [s1, s1_size] = mmap_pmem(f2); + auto [s0_sb, s0_size_sb] = mmap_pmem(f1); + auto [s1_sb, s1_size_sb] = mmap_pmem(f2); + auto s0 = s0_sb; + auto s0_size = s0_size_sb; + auto s1 = s1_sb; + auto s1_size = s1_size_sb; if (s0_size != s1_size) { std::cout << f1 << " and " << f2 << " have different file lengths, aborting" << std::endl; exit(-1);