20 #ifndef GRPPI_COMMON_CONTEXT_H 21 #define GRPPI_COMMON_CONTEXT_H 23 #include <type_traits> 35 template <
typename ExecutionPolicy,
typename Transformer>
47 context_t(ExecutionPolicy & e, Transformer && t) noexcept :
48 execution_policy_{e}, transformer_{t}
56 return execution_policy_;
73 return transformer_(std::forward<I>(item));
77 Transformer transformer_;
78 ExecutionPolicy& execution_policy_;
86 template<
typename E,
typename T>
Transformer & transformer()
Return the transformer function.
Definition: common/context.h:64
Definition: callable_traits.h:26
Representation of a context pattern. Represents a context that uses a given policy to run a transform...
Definition: common/context.h:36
Transformer transformer_type
Definition: common/context.h:39
ExecutionPolicy execution_policy_type
Definition: common/context.h:40
context_t(ExecutionPolicy &e, Transformer &&t) noexcept
Constructs a context with a execution policy and a transformer.
Definition: common/context.h:47
Definition: common/context.h:84
auto operator()(I &&item) const
Invokes the trasnformer of the context over a data item.
Definition: common/context.h:72
ExecutionPolicy & execution_policy()
Return the execution policy used in the context.
Definition: common/context.h:55
typename std::enable_if_t< is_context< T >, int > requires_context
Definition: common/context.h:95
static constexpr bool is_context
Definition: common/context.h:92