Interface for a type specializing the State
concept.
More...
#include <atria/xform/state_traits.hpp>
Static Public Member Functions | |
template<typename T > | |
static auto | is_reduced (T &&) -> bool |
Returns whether the value is idempotent, and thus, the reduction can finish. More... | |
template<typename T , typename D > | |
static auto | data (T &&, D &&d) -> decltype(std::forward< D >(d)()) |
Returns the associated from the current state. More... | |
template<typename T > | |
static auto | complete (T &&state) -> decltype(std::forward< T >(state)) |
Unwraps all the layers of state wrappers returning the deepmost. More... | |
template<typename T > | |
static auto | unwrap (T &&state) -> decltype(std::forward< T >(state)) |
Unwraps this layers of state wrappers, returning the nested state for the next reducing function. More... | |
template<typename T > | |
static auto | unwrap_all (T &&state) -> decltype(std::forward< T >(state)) |
Unwraps all layers of state wrappers, returning the most nested state for the innermost reducing function. More... | |
template<typename T , typename U > | |
static auto | rewrap (T &&, U &&x) -> decltype(std::forward< U >(x)) |
Copies all layers of state wrappers but replaces the innermost state with substate . More... | |
Detailed Description
template<typename StateT>
struct atria::xform::state_traits< StateT >
Interface for a type specializing the State
concept.
A State
is the first parameter of a reducing function, also known as the accumulator. Every type is a model of State
, with the following default implementation. However, one might want to specialize the state it for a particular accumulator type, such that transducers can operate with it. A transducer should not make assumptions about the state it receives, instead, it can only wrap it using wrap_state
to attach additional data.
For an example of a stateful reducing function, see take
.
- See also
- wrap_state
- take
Definition at line 53 of file state_traits.hpp.
Member Function Documentation
|
inlinestatic |
Unwraps all the layers of state wrappers returning the deepmost.
Definition at line 75 of file state_traits.hpp.
|
inlinestatic |
Returns the associated from the current state.
If the state contains no associated data, the default_data
will be returned.
Definition at line 68 of file state_traits.hpp.
|
inlinestatic |
Returns whether the value is idempotent, and thus, the reduction can finish.
Definition at line 60 of file state_traits.hpp.
|
inlinestatic |
Copies all layers of state wrappers but replaces the innermost state with substate
.
Definition at line 99 of file state_traits.hpp.
|
inlinestatic |
Unwraps this layers of state wrappers, returning the nested state for the next reducing function.
Definition at line 83 of file state_traits.hpp.
|
inlinestatic |
Unwraps all layers of state wrappers, returning the most nested state for the innermost reducing function.
Definition at line 91 of file state_traits.hpp.
The documentation for this struct was generated from the following file:
- src/atria/xform/state_traits.hpp