19template <
class R,
class... Args>
35 std::is_invocable_r_v<R, F &&, Args...>)
37 : obj_(const_cast<
void*>(
38 reinterpret_cast<const
void*>(
std::addressof(f)))) {
39 callback_ = [](
void* obj, Args... args) -> R {
41 *
reinterpret_cast<typename std::add_pointer<F>::type
>(obj),
42 std::forward<Args>(args)...);
56 requires std::is_invocable_r_v<R, F&&, Args...>
58 obj_ =
reinterpret_cast<void*
>(std::addressof(f));
59 callback_ = [](
void* obj, Args... args) {
61 *
reinterpret_cast<typename std::add_pointer<F>::type
>(obj),
62 std::forward<Args>(args)...);
80 return callback_(obj_, std::forward<Args>(args)...);
85 R (*callback_)(
void*, Args...) =
nullptr;
91template <
typename R,
typename... Args>
97template <
typename R,
typename... Args>
constexpr function_ref< R(Args...)> & operator=(F &&f) noexcept
Makes *this refer to f.
Definition FunctionRef.hpp:57
constexpr void swap(function_ref< R(Args...)> &rhs) noexcept
Swaps the referred callables of *this and rhs.
Definition FunctionRef.hpp:71
R operator()(Args... args) const
Call the stored callable with the given arguments.
Definition FunctionRef.hpp:79
constexpr function_ref< R(Args...)> & operator=(const function_ref< R(Args...)> &rhs) noexcept=default
Makes *this refer to the same callable as rhs.
constexpr function_ref() noexcept=delete
An implementation of std::function_ref, a lightweight non-owning reference to a callable.
Definition FunctionRef.hpp:17
Definition Hessian.hpp:18
constexpr void swap(function_ref< R(Args...)> &lhs, function_ref< R(Args...)> &rhs) noexcept
Swaps the referred callables of lhs and rhs.
Definition FunctionRef.hpp:92
function_ref(R(*)(Args...)) -> function_ref< R(Args...)>
Implement std::hash so that hash_code can be used in STL containers.
Definition PointerIntPair.h:280
WPI_BASIC_JSON_TPL_DECLARATION void swap(wpi::WPI_BASIC_JSON_TPL &j1, wpi::WPI_BASIC_JSON_TPL &j2) noexcept(//NOLINT(readability-inconsistent-declaration-parameter-name, cert-dcl58-cpp) is_nothrow_move_constructible< wpi::WPI_BASIC_JSON_TPL >::value &&//NOLINT(misc-redundant-expression, cppcoreguidelines-noexcept-swap, performance-noexcept-swap) is_nothrow_move_assignable< wpi::WPI_BASIC_JSON_TPL >::value)
exchanges the values of two JSON objects
Definition json.h:5258
typename std::decay< T >::type decay_t
Definition base.h:311