14#ifndef WPIUTIL_WPI_FUNCTION_REF_H_
15#define WPIUTIL_WPI_FUNCTION_REF_H_
33template <
typename Ret,
typename... Params>
35 Ret (*callback)(intptr_t callable, Params... params) =
nullptr;
38 template <
typename Callable>
39 static Ret callback_fn(intptr_t callable, Params... params) {
40 return (*
reinterpret_cast<Callable*
>(callable))(std::forward<Params>(
48 template <
typename Callable>
51 typename std::enable_if<
54 : callback(callback_fn<typename
std::remove_reference<Callable>::
type>),
55 callable(reinterpret_cast<intptr_t>(&callable)) {}
58 return callback(callable, std::forward<Params>(params)...);
61 explicit operator bool()
const {
return callback; }
Ret operator()(Params... params) const
Definition: function_ref.h:57
function_ref(std::nullptr_t)
Definition: function_ref.h:46
function_ref(Callable &&callable, typename std::enable_if< !std::is_same< typename std::remove_reference< Callable >::type, function_ref >::value >::type *=nullptr)
Definition: function_ref.h:49
An efficient, type-erasing, non-owning reference to a callable.
Definition: function_ref.h:31
type
Definition: core.h:575
Definition: StdDeque.h:50
/file This file defines the SmallVector class.
Definition: AprilTagFieldLayout.h:18