7#include "utility/module.hpp"
11namespace hi::inline
v1 {
13template<
typename Proto>
16template<
typename Result,
typename... Arguments>
19 using result_type = Result;
22 virtual result_type operator()(Arguments... arguments) = 0;
27template<
typename Function,
typename Proto>
30template<
typename Function,
typename Result,
typename... Arguments>
33 using result_type =
typename function<Result(Arguments...)>::result_type;
35 template<
typename Func>
36 function_impl(Func&& func) noexcept : _function(std::forward<Func>(func))
40 result_type operator()(Arguments... arguments)
override
42 return _function(
std::forward<
decltype(arguments)>(arguments)...);
49template<
typename Function,
typename Proto>
52template<
typename Function,
typename... Arguments>
55 using result_type = void;
56 using async_result_type = std::invoke_result_t<Function, Arguments...>;
58 template<
typename Func>
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();
93template<
typename Proto,
typename Func>
94auto make_function(Func&& func)
99template<
typename Proto,
typename Func>
100auto make_async_function(Func&& func)
102 return detail::async_function_impl<std::decay_t<Func>, Proto>{std::forward<Func>(func)};
DOXYGEN BUG.
Definition algorithm.hpp:13
Definition functional.hpp:14
Definition functional.hpp:28
Definition functional.hpp:50
T current_exception(T... args)