hpx::function_ref#
Defined in header hpx/functional.hpp.
See Public API for a list of names and headers that are part of the public HPX API.
- 
namespace hpx
- Top level namespace. - 
template<typename Sig>
 class function_ref#
- #include <function_ref.hpp>function_refclass is a vocabulary type with reference semantics for passing entities to call.An example use case that benefits from higher-order functions is retry(n,f)which attempts to callfup tontimes synchronously until success. This example might model the real-world scenario of repeatedly querying a flaky web service.The passed-in action should be a callable entity that takes no arguments and returns a payload. This can be done with function pointers,using payload = std::optional< /* ... */ >; // Repeatedly invokes `action` up to `times` repetitions. // Immediately returns if `action` returns a valid `payload`. // Returns `std::nullopt` otherwise. payload retry(size_t times, /* ????? */ action); hpx::functionor a template but it is much simpler withfunction_refas seen below:payload retry(size_t times, function_ref<payload()> action); 
 - 
template<typename R, typename ...Ts>
 class function_ref<R(Ts...)>#
- Public Functions - 
template<typename F, typename FD = std::decay_t<F>, typename Enable = std::enable_if_t<!std::is_same_v<FD, function_ref> && is_invocable_r_v<R, F&, Ts...>>>
 inline function_ref(F &&f)#
 - 
inline function_ref(function_ref const &other) noexcept#
 - 
template<typename F, typename FD = std::decay_t<F>, typename Enable = std::enable_if_t<!std::is_same_v<FD, function_ref> && is_invocable_r_v<R, F&, Ts...>>>
 inline function_ref &operator=(F &&f)#
 - 
inline function_ref &operator=(function_ref const &other) noexcept#
 - 
template<typename F, typename T = std::remove_reference_t<F>, typename Enable = std::enable_if_t<!std::is_pointer_v<T>>>
 inline void assign(F &&f)#
 - 
inline void swap(function_ref &f) noexcept#
 - 
inline char const *get_function_annotation() const#
 
- 
template<typename F, typename FD = std::decay_t<F>, typename Enable = std::enable_if_t<!std::is_same_v<FD, function_ref> && is_invocable_r_v<R, F&, Ts...>>>
 - 
namespace util
 
- 
template<typename Sig>
