Lumiera  0.pre.03
»edit your freedom«
ExtensibleFilterIter< IT > Class Template Reference

#include "lib/itertools.hpp"

Description

template<class IT>
class lib::ExtensibleFilterIter< IT >

Additional capabilities for FilterIter, allowing to extend the filter condition underway.

This wrapper enables remoulding of the filer functor while in the middle of iteration. When the filter is modified, current head of iteration gets re-evaluated and possible fast-forwarded to the next element satisfying the now extended filter condition.

Note
changing the condition modifies a given iterator in place. Superficially this might look as if the storage remains the same, but in fact we're adding a lambda closure, which the runtime usually allocates on the heap, holding the previous functor and a second functor for the added clause.
Warning
the addition of disjunctive and negated clauses might actually weaken the filter condition. Yet still there is no reset of the source iterator, i.e. we don't re-evaluate from start, but just from current head. Which means we might miss elements in the already consumed part of the source sequence, which theoretically would pass the now altered filter condition.
See also
IterTools_test::verify_filterExtension

Definition at line 410 of file itertools.hpp.

Public Member Functions

template<typename PRED >
 ExtensibleFilterIter (IT &&src, PRED initialFilterPredicate)
 
- Public Member Functions inherited from FilterIter< IT >
template<typename PRED >
 FilterIter (IT const &src, PRED filterPredicate)
 
template<typename PRED >
 FilterIter (IT &&src, PRED filterPredicate)
 
- Public Member Functions inherited from IterTool< FilterCore< IT > >
 IterTool (FilterCore< IT > &&setup)
 
bool empty () const
 
bool isValid () const
 
 operator bool () const
 
reference operator* () const
 
IterTooloperator++ ()
 
pointer operator-> () const
 

Private Types

using _Filter = FilterCore< IT >
 
using Val = typename _Filter::Val
 

Private Member Functions

void reEvaluate ()
 

Additional Inherited Members

- Public Types inherited from IterTool< FilterCore< IT > >
typedef FilterCore< IT > ::pointer pointer
 
typedef FilterCore< IT > ::reference reference
 
typedef FilterCore< IT > ::value_type value_type
 
- Static Public Member Functions inherited from FilterIter< IT >
static bool acceptAll (typename _Filter::Val)
 
- Protected Member Functions inherited from IterTool< FilterCore< IT > >
void _maybe_throw () const
 
bool hasData () const
 
bool iterate ()
 
- Protected Attributes inherited from IterTool< FilterCore< IT > >
FilterCore< IT > core_
 
+ Inheritance diagram for ExtensibleFilterIter< IT >:
+ Collaboration diagram for ExtensibleFilterIter< IT >:

The documentation for this class was generated from the following file: