34class function_impl<Function, Result(Arguments...)> final :
public function<Result(Arguments...)> {
36 using result_type =
typename function<Result(Arguments...)>::result_type;
38 template<
typename Func>
43 result_type operator()(Arguments... arguments)
override
45 return _function(
std::forward<
decltype(arguments)>(arguments)...);
56class async_function_impl<Function, void(Arguments...)> final :
public function<void(Arguments...)> {
58 using result_type = void;
59 using async_result_type = std::invoke_result_t<Function, Arguments...>;
61 template<
typename Func>
62 async_function_impl(Func&& func) noexcept : _function(
std::forward<Func>(func)), _promise()
66 void operator()(Arguments... arguments)
override
68 if constexpr (std::is_same_v<async_result_type, void>) {
70 _function(
std::forward<
decltype(arguments)>(arguments)...);
77 _promise.set_value(_function(
std::forward<
decltype(arguments)>(arguments)...));
86 return _promise.get_future();