template <typename H, typename... Args>
typename H::answer_type handle(
int64_t label, std::function<typename H::body_type()> body, Args&&... args);
template <typename H, typename... Args>
typename H::answer_type handle(std::function<typename H::body_type()> body, Args&&... args);
Create a new handler of type H
and use it to handle the computation body
.
-
typename H
- The type of the handler that is used to handlebody
. -
typename... Args
- Arguments supplied to the constructor ofH
. -
int64_t label
- Explicit label of the handler. If no label is given, this handler is used based on the types of the commandss ofH
(the innermost handler that handles the invoked command is used). -
std::function<typename H::body_type()> body
- The handled computation. -
Return value
H::answer_type
- The final answer of the handler, returned by one of the overloads ofH::handle_command
orH::handle_return
.
Note: handle<H>(b)
is equivalent to handle_with(b, std::make_shared<H>())
.