35class function_impl<Function, Result(Arguments...)> final :
public function<Result(Arguments...)> {
37 using result_type =
typename function<Result(Arguments...)>::result_type;
39 template<
typename Func>
44 result_type operator()(Arguments... arguments)
override
46 return _function(
std::forward<
decltype(arguments)>(arguments)...);
57class async_function_impl<Function, void(Arguments...)> final :
public function<void(Arguments...)> {
59 using result_type = void;
60 using async_result_type = std::invoke_result_t<Function, Arguments...>;
62 template<
typename Func>
63 async_function_impl(Func&& func) noexcept : _function(
std::forward<Func>(func)), _promise()
67 void operator()(Arguments... arguments)
override
69 if constexpr (std::is_same_v<async_result_type, void>) {
71 _function(
std::forward<
decltype(arguments)>(arguments)...);
78 _promise.set_value(_function(
std::forward<
decltype(arguments)>(arguments)...));
87 return _promise.get_future();