transducer_impl< ReducingFnGenT, ParamTs > Struct Template Reference

Utility to write simple transducers easily. More...

#include <atria/xform/transducer_impl.hpp>

Public Types

using base_t = std::tuple< ParamTs... >
 

Public Member Functions

 transducer_impl (const transducer_impl &)=default
 
 transducer_impl (transducer_impl &&)=default
 
transducer_imploperator= (const transducer_impl &)=default
 
transducer_imploperator= (transducer_impl &&)=default
 
template<typename... Ts>
 transducer_impl (Ts...ts)
 
template<typename ReducingFnT >
constexpr auto operator() (ReducingFnT &&step) const -> typename ReducingFnGenT::template apply< estd::decay_t< ReducingFnT >, estd::decay_t< ParamTs >... >
 
template<typename ReducingFnT , std::size_t... indexes_t>
constexpr auto make (ReducingFnT &&step, estd::index_sequence< indexes_t... >) const -> typename ReducingFnGenT::template apply< estd::decay_t< ReducingFnT >, estd::decay_t< ParamTs >... >
 

Detailed Description

template<typename ReducingFnGenT, typename... ParamTs>
struct atria::xform::transducer_impl< ReducingFnGenT, ParamTs >

Utility to write simple transducers easily.

Most transducers have the following structure:

1 xducer params... = -- 1. this returns a transducer
2  \ step -> -- 2. this is a transducer
3  \ state, input -> -- 3. this is transformed version of 'step'
4  f(params..., step, state, input)

Writing functions that return functions without erasing their type is very cumbersome in C++11 (this is not true with generic lambdas and decltype(auto) in the next standard). The transducer_impl type implements the first two calls. The ReducingFnGenT parameter should have a nested template apply that implements the last call. It will be constructed step, params... and it should be callable with state, input.

See also
map
filter

Definition at line 60 of file transducer_impl.hpp.


The documentation for this struct was generated from the following file:
Fork me on GitHub