template <typename Action, typename Tag = void, typename Model, typename EventLoop, typename… Enhancers>
auto lager::make_store(Model &&init, EventLoop &&loop, Enhancers&&... enhancers)

Builds a lager::store that glues together the core components of an interactive application following an unidirectional data flow architecture.

Template Parameters
  • Action: Value type that represents an event (an interaction) happening in the application.
  • Tag: Use automatic_tag to indicate that the store should automatically make changes visible notified after every action is processed. Use transactional_tag to require a lager::commit call for that.
  • init: Initial value of the data-model. It should be a value-type.
  • loop: Event loop in which operations can be scheduled. This allows thread-safe action dispatching reusing the technology provided by the UI framework at hand (it does not need to be the event-loop of a UI framework.)
  • enhancer: Optional middleware that enhances or modified the applications behavior in a general way.


The term reducer is due to the fact that, if we consider the sequence of actions over time, this function “reduces” the sequence to a single model value. This is a pure function and it should have no side-effects—it takes a model value with the current state of the world, and it should return a new model value with the updated state of the world. If we evaluate the function with the same arguments, it should always return exactly the same arguments. If, given the current action, it decides that some side-effects are required (reading or writing files, generating random numbers, making network requests, etc.) it should use the second signature, which allows to schedule side-effects.

template <typename Action, typename Tag = automatic_tag, typename Model, typename EventLoop>
auto lager::make_store(Model &&init, EventLoop &&loop)


template <typename… Args>
auto lager::with_deps(Args&&... args)

Store enhancer that adds dependencies to the store.

The dependencies are constructed as by make_deps().


template <typename Action, typename Model, typename Dependencies = lager::deps<>>
class lager::store

Stores the data model for and glues together the components to observe and update it.

lager::make_store for details about the different initialization components.

Inherits from lager::context< Action, Dependencies >, lager::reader_base< detail::store_node_base< Action, Model > >

Public Types

using action_t = Action
using model_t = Model
using deps_t = Dependencies

Public Functions

template <typename ReducerFn, typename EventLoop, typename Deps, typename Tags>
store(model_t init, ReducerFn reducer, EventLoop loop, Deps dependencies, Tags tags)
template <typename Action_, typename Model_, typename Deps_, std::enable_if_t< std::is_convertible_v< Deps_, Dependencies >, bool > = true>
store(store<Action_, Model_, Deps_> other)
store &operator=(store&&)
store(const store&)

Deleted copies, this is a move-only type.

store &operator=(const store&)


friend lager::store::detail::access