31class function_impl<Function, Result(Arguments...)> final :
public function<Result(Arguments...)> {
33 using result_type =
typename function<Result(Arguments...)>::result_type;
35 template<
typename Func>
40 result_type operator()(Arguments... arguments)
override
42 return _function(
std::forward<
decltype(arguments)>(arguments)...);
53class async_function_impl<Function, void(Arguments...)> final :
public function<void(Arguments...)> {
55 using result_type = void;
56 using async_result_type = std::invoke_result_t<Function, Arguments...>;
58 template<
typename Func>
59 async_function_impl(Func&& func) noexcept : _function(
std::forward<Func>(func)), _promise()
63 void operator()(Arguments... arguments)
override
65 if constexpr (std::is_same_v<async_result_type, void>) {
67 _function(
std::forward<
decltype(arguments)>(arguments)...);
74 _promise.set_value(_function(
std::forward<
decltype(arguments)>(arguments)...));
83 return _promise.get_future();