7 #ifndef PXR_BASE_TF_FUNCTION_REF_H
8 #define PXR_BASE_TF_FUNCTION_REF_H
13 #include <type_traits>
81 template <
class Ret,
class... Args>
88 template <
typename Fn>
89 using _IsFunctionRef = std::is_same<
90 std::remove_cv_t<std::remove_reference_t<Fn>>,
TfFunctionRef>;
96 : _fn(static_cast<void const *>(std::addressof(fn)))
97 , _invoke(_InvokeFn<Fn>) {}
126 return _invoke(_fn, std::forward<Args>(
args)...);
131 static Ret _InvokeFn(
void const *fn, Args...args) {
132 using FnPtr =
typename std::add_pointer<
134 return (*static_cast<FnPtr>(fn))(std::forward<Args>(
args)...);
138 Ret (*_invoke)(
void const *, Args...);
151 #endif // PXR_BASE_TF_FUNCTION_REF_H
void swap(ArAssetInfo &lhs, ArAssetInfo &rhs)
void swap(UT::ArraySet< Key, MULTI, MAX_LOAD_FACTOR_256, Clearer, Hash, KeyEqual > &a, UT::ArraySet< Key, MULTI, MAX_LOAD_FACTOR_256, Clearer, Hash, KeyEqual > &b)
GLsizei const GLfloat * value
std::enable_if_t<!_IsFunctionRef< Fn >::value, TfFunctionRef & > operator=(Fn &fn) noexcept
Assign from an lvalue callable fn.
void swap(TfFunctionRef &other) noexcept
constexpr TfFunctionRef(Fn &fn) noexcept
Construct with an lvalue callable fn.
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
LeafData & operator=(const LeafData &)=delete
#define PXR_NAMESPACE_CLOSE_SCOPE
**If you just want to fire and args
Ret operator()(Args...args) const
Invoke the callable that this object refers to with args.