From 84c30fe802953251778bfbc53f291811ec8e7fba Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sat, 15 Sep 2018 17:19:13 +0200 Subject: [PATCH] ChainSearch: need to gear up immediately after backtracking ...which can be achieved by checking the backtracking loop always right after the non-backtracking iteration, exploiting the fact that the guard conditions of both are complimentary. So the only case when we'd actually enter the backtracking loop after regular iteration would precisely be when we drop down due to exahausting an upper layer. The result now reads "sausage-bacon-tomato-and-spam-spam-bacon-spam-tomato-and-spam-bacon-tomato-and-bacon-tomato-and-tomato-and" ...which sounds correct, yay! --- src/lib/iter-chain-search.hpp | 18 ++++++++---------- wiki/thinkPad.ichthyo.mm | 25 +++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/src/lib/iter-chain-search.hpp b/src/lib/iter-chain-search.hpp index 4c7e96145..6b3a13666 100644 --- a/src/lib/iter-chain-search.hpp +++ b/src/lib/iter-chain-search.hpp @@ -192,16 +192,14 @@ namespace iter { _Base::__throw_if_empty(); if (not needsExpansion()) _Base::iterNext(); - else - do - { - uint depth =_Base::depth(); - _Base::expandChildren(); // create copy of current filter embedded into child level - stepChain_[depth] (_Base::accessCurrentChildIter()); // invoke step functor to reconfigure this filter... - _Base::dropExhaustedChildren(); // which thereby might become empty - } - while (needsExpansion() // Backtracking loop: attempt to establish all conditions - and _Base::checkPoint()); // possibly trying further combinations until success: + while (needsExpansion() // Backtracking loop: attempt to establish all conditions + and _Base::checkPoint()) // possibly trying further combinations until success: + { + uint depth =_Base::depth(); + _Base::expandChildren(); // create copy of current filter embedded into child level + stepChain_[depth] (_Base::accessCurrentChildIter()); // invoke step functor to reconfigure this filter... + _Base::dropExhaustedChildren(); // which thereby might become empty + } } IterChainSearch& diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index f06848cc2..0d4bdb3ab 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -32466,7 +32466,7 @@ - + @@ -32478,7 +32478,28 @@ - + + + + + + + + + + + + + + + +

+ sausage-bacon-tomato-and-spam-spam-bacon-spam-tomato-and-spam-bacon-tomato-and-bacon-tomato-and-tomato-and +

+ + +
+