diff --git a/src/lib/iter-chain-search.hpp b/src/lib/iter-chain-search.hpp index 353f73c86..e40b8e3a8 100644 --- a/src/lib/iter-chain-search.hpp +++ b/src/lib/iter-chain-search.hpp @@ -77,16 +77,21 @@ namespace iter { } /** - * @internal implementation for.... + * @internal helper to rebind on inferred types. + * @remark we use the TreeExplorer framework to assemble the processing pipeline + * from suitable building blocks configured with some lambdas. However, we + * also want to _inherit_ from this filter pipeline, so to expose the typical + * iterator operations without much ado. Thus we use some (static) helper function + * templates, instantiate them with the actual source data iterator and pick up + * the inferred type. */ template - class _IterChainSetup + struct _IterChainSetup { using Filter = decltype( buildSearchFilter (std::declval()) ); using StepFunctor = typename iter_explorer::_BoundFunctor::Functor; - public: using Pipeline = decltype( buildExplorer (std::declval(), std::declval()) ); }; @@ -108,40 +113,25 @@ namespace iter { class IterChainSearch : public _IterChainSetup::Pipeline { - using _Base = typename _IterChainSetup::Pipeline; -// using _Parent = IterStateWrapper; + using _Trait = _IterChainSetup; + using _Base = typename _Trait::Pipeline; + + using Filter = typename _Trait::Filter; + using Step = typename _Trait::StepFunctor; public: using DebugPipeline = _Base; -// IterChainSearch() =default; -// IterChainSearch (IterChainSearch&&) =default; -// IterChainSearch (IterChainSearch const&) =default; -// IterChainSearch& operator= (IterChainSearch&&) =default; -// IterChainSearch& operator= (IterChainSearch const&) =default; + using _Base::_Base; -// template -// explicit -// IterChainSearch (CON& container) -//// : _Parent(_Core(container.begin(), container.end())) -// { } -// -// IterChainSearch (IT&& begin, IT&& end) -//// : _Parent(_Core(std::forward(begin), std::forward(end))) -// { } + template + explicit + IterChainSearch (SEQ&& srcData) + : _Base{move (buildExplorer (forward (srcData) + ,Step{[this](Filter const& curr){ return configureFilterChain(curr); }}))} + { } - operator bool() const - { - UNIMPLEMENTED ("solution test"); - } - - bool - empty() const - { - return not(*this); - } - /** */ IterChainSearch&& @@ -158,21 +148,13 @@ namespace iter { return move(*this); } - - /////////////////////////TODO dummy placeholder code. Replace by real iterator access - string& - operator*() const + private: + Filter + configureFilterChain (Filter const& currentFilterState) { - static string boo{"bääääh"}; - return boo; + uint depth = this->depth(); + return Filter{}; /////TODO empty filter means recursion end } - - IterChainSearch& - operator++() - { - return *this; - } - /////////////////////////TODO dummy placeholder code. Replace by real iterator access }; @@ -192,11 +174,7 @@ namespace iter { inline auto chainSearch (SRC&& srcData) { -// using SrcIter = typename _DecoratorTraits::SrcIter; -// using Base = iter_explorer::BaseAdapter; - - return IterChainSearch(); -// return TreeExplorer (std::forward (srcSeq)); + return IterChainSearch{forward (srcData)}; } diff --git a/tests/library/iter-chain-search-test.cpp b/tests/library/iter-chain-search-test.cpp index eb6f82f11..d7ff544a3 100644 --- a/tests/library/iter-chain-search-test.cpp +++ b/tests/library/iter-chain-search-test.cpp @@ -116,6 +116,9 @@ namespace test{ SHOW_TYPE (Searcher::pointer); // TypeDebugger guggi; // --> std::__cxx11::basic_string const& + cout << "search[0]=" <<*search< - + + @@ -31288,7 +31289,7 @@ - + @@ -31429,19 +31430,20 @@ - - - - + + + + + - - + +