From 795b79e85d4107038efd442da16d27e30675e002 Mon Sep 17 00:00:00 2001 From: Joshua Moerman Date: Tue, 7 Apr 2015 09:02:06 +0200 Subject: [PATCH] Replaces the poly-lambdas with typed lambdas :( --- lib/partition.hpp | 2 +- lib/splitting_tree.cpp | 6 +++--- lib/write_tree_to_dot.cpp | 2 +- src/main.cpp | 5 ++++- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/partition.hpp b/lib/partition.hpp index 3385f53..ade9e0b 100644 --- a/lib/partition.hpp +++ b/lib/partition.hpp @@ -33,6 +33,6 @@ auto partition_(Iterator b, Iterator e, Fun && function, size_t output_size) { ar->splice(ar->end(), elements, current); } - assert(s == accumulate(begin(blocks), end(blocks), 0, [](auto && l, auto && r) { return l + r.size(); })); + assert(s == accumulate(begin(blocks), end(blocks), 0, [](size_t l, const list & r) { return l + r.size(); })); return blocks; } diff --git a/lib/splitting_tree.cpp b/lib/splitting_tree.cpp index a29c5ea..b7d2a7c 100644 --- a/lib/splitting_tree.cpp +++ b/lib/splitting_tree.cpp @@ -49,7 +49,7 @@ result create_splitting_tree(const mealy& g, options opt){ mt19937 generator(rd()); // Some lambda functions capturing some state, makes the code a bit easier :) - const auto add_push_new_block = [&work](auto new_blocks, auto & boom) { + const auto add_push_new_block = [&work](list> const & new_blocks, splitting_tree& boom) { boom.children.assign(new_blocks.size(), splitting_tree(0, boom.depth + 1)); auto i = 0; @@ -61,9 +61,9 @@ result create_splitting_tree(const mealy& g, options opt){ work.push(c); } - assert(boom.states.size() == accumulate(begin(boom.children), end(boom.children), 0, [](auto l, auto r) { return l + r.states.size(); })); + assert(boom.states.size() == accumulate(begin(boom.children), end(boom.children), 0, [](size_t l, const splitting_tree & r) { return l + r.states.size(); })); }; - const auto is_valid = [N, opt, &g](auto blocks, auto symbol){ + const auto is_valid = [N, opt, &g](list> const & blocks, input symbol){ if(!opt.check_validity) return true; for(auto && block : blocks) { diff --git a/lib/write_tree_to_dot.cpp b/lib/write_tree_to_dot.cpp index ce3cc18..63df936 100644 --- a/lib/write_tree_to_dot.cpp +++ b/lib/write_tree_to_dot.cpp @@ -37,7 +37,7 @@ void write_adaptive_distinguishing_sequence_to_dot(const adaptive_distinguishing out << node.word; } else { vector I(node.CI.size()); - transform(begin(node.CI), end(node.CI), begin(I), [](auto p){ return p.second; }); + transform(begin(node.CI), end(node.CI), begin(I), [](const pair p){ return p.second; }); out << "I = " << I; } }, out); diff --git a/src/main.cpp b/src/main.cpp index e1d0e44..428997f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -121,10 +121,12 @@ int main(int argc, char *argv[]) try { const auto transfer_sequences = transfer_sequences_fut.get(); const auto inputs = inputs_fut.get(); - const auto print_word = [&](auto w){ + const auto print_word = [&](vector w){ for(auto && x : w) cout << inputs[x] << ' '; }; +// This part is commented out, as the polymorphic lambdas are kinda important +#if 0 if(statistics){ const auto adder = [](auto const & x){ return [&x](auto const & l, auto const & r) { return l + x(r); }; @@ -168,6 +170,7 @@ int main(int argc, char *argv[]) try { length += 1; } } +#endif if(streaming){ time_logger t("outputting all preset tests");