state_wrapper< TagT, StateT, DataT > Struct Template Reference
A decorator for the accumulator of a reduction. More...
#include <atria/xform/state_wrapper.hpp>
Public Types | |
using | tag = TagT |
using | base_t = std::tuple< StateT, DataT > |
Public Member Functions | |
state_wrapper (const state_wrapper &)=default | |
state_wrapper (state_wrapper &&)=default | |
state_wrapper & | operator= (const state_wrapper &)=default |
state_wrapper & | operator= (state_wrapper &&)=default |
template<typename T , typename U > | |
state_wrapper (T &&st, U &&data) | |
Detailed Description
template<typename TagT = no_tag, typename StateT = void, typename DataT = void>
struct atria::xform::state_wrapper< TagT, StateT, DataT >
A decorator for the accumulator of a reduction.
A transducer must not make any assumptions about the accumulator of the process it is helping to reduce. However, a stateful transducer may use a state_wrapper
to attach extra data to the accumulator such that the reducing function object itself can be state-less.
A state wrapper has the following template arguments:
- Template Parameters
-
TagT is as tag type used to identify the transducer that is attaching the state. This can useful to specialize the state_traits
for a concrete state wrapper.StateT is the accumulator that is to be wrapped and of which we shall make no assumptions. DataT is the additional data that the transducer wants to attach to represent its own state.
For an example of a stateful reducing function,
- See also
- take
- wrap_state
- state_traits
Definition at line 69 of file state_wrapper.hpp.
The documentation for this struct was generated from the following file:
- src/atria/xform/state_wrapper.hpp