From b4edf8e33cb67b4a2dd1ce09dbee940ca9c5f984 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sun, 2 Sep 2018 19:28:11 +0200 Subject: [PATCH] TreeExplorer: find a way to extract the boilerplate ...based on generic lambdas, which are effectively template classes themselves --- src/lib/iter-tree-explorer.hpp | 14 +++++++++----- wiki/thinkPad.ichthyo.mm | 22 ++++++++++++++++++++++ 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/src/lib/iter-tree-explorer.hpp b/src/lib/iter-tree-explorer.hpp index 9e4227c5f..be6f25da0 100644 --- a/src/lib/iter-tree-explorer.hpp +++ b/src/lib/iter-tree-explorer.hpp @@ -926,12 +926,16 @@ namespace lib { FilterPredicate& firstClause = this->predicate_; ChainPredicate chainClause{forward (conjunctiveClause)}; + auto buildCombinedClause = [](auto first, auto second) + { + return [=](auto val) + { + return first(val) + and second(val); + }; + }; - predicate_ = FilterPredicate{[firstClause, chainClause] (auto val) - { - return firstClause(val) - and chainClause(val); - } }; + predicate_ = FilterPredicate{buildCombinedClause (firstClause, chainClause)}; pullFilter(); } diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index cff9e76e8..d5494fb5d 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -30977,10 +30977,32 @@ + + + + + + + +

+ Name: mutableFilter() +

+ + +
+ +
+ + + + + + +