16 #ifndef GRPPI_COMMON_CONTEXT_H
17 #define GRPPI_COMMON_CONTEXT_H
19 #include <type_traits>
31 template <
typename ExecutionPolicy,
typename Transformer>
43 context_t(ExecutionPolicy & e, Transformer && t) noexcept :
44 execution_policy_{e}, transformer_{t}
52 return execution_policy_;
69 return transformer_(std::forward<I>(item));
73 ExecutionPolicy& execution_policy_;
74 Transformer transformer_;
82 template<
typename E,
typename T>
Representation of a context pattern. Represents a context that uses a given policy to run a transform...
Definition: common/context.h:32
ExecutionPolicy execution_policy_type
Definition: common/context.h:36
Transformer transformer_type
Definition: common/context.h:35
context_t(ExecutionPolicy &e, Transformer &&t) noexcept
Constructs a context with a execution policy and a transformer.
Definition: common/context.h:43
auto operator()(I &&item) const
Invokes the transformer of the context over a data item.
Definition: common/context.h:68
ExecutionPolicy & execution_policy()
Return the execution policy used in the context.
Definition: common/context.h:51
Transformer & transformer()
Return the transformer function.
Definition: common/context.h:60
Definition: callable_traits.h:21
static constexpr bool is_context
Definition: common/context.h:88
typename std::enable_if_t< is_context< T >, int > requires_context
Definition: common/context.h:91
Definition: common/context.h:80