Lumiera  0.pre.03
»edit your freedom«
IterableDecorator< T, COR > Class Template Reference

#include "lib/iter-adapter.hpp"

Description

template<typename T, class COR>
class lib::IterableDecorator< T, COR >

Decorator-Adapter to make a »state core« iterable as Lumiera Forward Iterator.

This is a fundamental (and low-level) building block and works essentially the same as IterStateWrapper — with the significant difference however that the Core is mixed in by inheritance and thus its full interface remains publicly accessible. Another notable difference is that this adapter deliberately performs no sanity-checks. This can be dangerous, but allows to use this setup even in performance critical code.

Warning
be sure to understand the consequences of using ´core.yield()´ without checks; it might be a good idea to build safety checks into the Core API functions instead, or to wrap the Core into CheckedCore.
Template Parameters
Tnominal result type (maybe const, but without reference). The resulting iterator will yield a reference to this type T
CORtype of the »state core«. The resulting iterator will mix-in this type, and thus inherit properties like copy, move, compare, VTable, POD. The COR must implement the following iteration control API:
  1. checkPoint establishes if the given state element represents a valid state
  2. ´iterNextevolves this state by one step (sideeffect) -#yieldrealises the given state, exposing a result of typeT&`
See also
IterExplorer a pipeline builder framework on top of IterableDecorator
iter-explorer-test.hpp
iter-adaptor-test.cpp

Definition at line 599 of file iter-adapter.hpp.

Public Types

typedef T * pointer
 
typedef T & reference
 
typedef T value_type
 

Public Member Functions

template<typename... ARGS>
 IterableDecorator (ARGS &&...init)
 by default, pass anything down for initialisation of the core. More...
 
 IterableDecorator (IterableDecorator &&)=default
 
 IterableDecorator (IterableDecorator const &)=default
 
bool empty () const
 
 ENABLE_USE_IN_STD_RANGE_FOR_LOOPS (IterableDecorator)
 
bool isValid () const
 
 operator bool () const
 
reference operator* () const
 
IterableDecoratoroperator++ ()
 
pointer operator-> () const
 
IterableDecoratoroperator= (IterableDecorator &&)=default
 
IterableDecoratoroperator= (IterableDecorator const &)=default
 

Friends

template<class T1 , class T2 >
bool operator!= (IterableDecorator< T1, COR > const &il, IterableDecorator< T2, COR > const &ir)
 
template<class T1 , class T2 >
bool operator== (IterableDecorator< T1, COR > const &il, IterableDecorator< T2, COR > const &ir)
 Supporting equality comparisons of equivalent iterators (equivalent state core)...
 

Protected Member Functions

void __throw_if_empty () const
 

Private Member Functions

COR & _core ()
 
COR const & _core () const
 

Constructor & Destructor Documentation

◆ IterableDecorator()

IterableDecorator ( ARGS &&...  init)
inline

by default, pass anything down for initialisation of the core.

Note
especially this allows move-initialisation from an existing core.
Remarks
to prevent this rule from "eating" the standard copy operations, and the no-op default ctor, we need to declare them explicitly below.

Definition at line 624 of file iter-adapter.hpp.

+ Inheritance diagram for IterableDecorator< T, COR >:
+ Collaboration diagram for IterableDecorator< T, COR >:

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