extensible filter: add re-evaluation (test PASS)

this is the tiny bit of operational functionality needed on top:
whenever we're reconfiguring the predicate, we need to re-trigger
the evaluation (and clear the cached value)

n.b.: I've verified in debugger that the closure is
allocated on the heap and the functors are passed by value
This commit is contained in:
Fischlurch 2015-12-05 01:31:23 +01:00
parent 075653a815
commit 0e41555402

View file

@ -366,6 +366,13 @@ namespace lib {
typedef FilterCore<IT> _Filter;
typedef typename _Filter::Val Val;
void
reEvaluate()
{
this->core_.cached_ = false;
this->hasData(); // re-evaluate head element
}
public:
ExtensibleFilterIter() { }
@ -374,6 +381,7 @@ namespace lib {
: FilterIter<IT>(src, initialFilterPredicate)
{ }
template<typename COND>
ExtensibleFilterIter&
andFilter (COND conjunctiveClause)
@ -385,6 +393,7 @@ namespace lib {
return filter(val)
and conjunctiveClause(val);
};
reEvaluate();
return *this;
}
};