Go to the documentation of this file.
12 #define PYBIND11_HAS_TYPE_CASTER_STD_FUNCTION_SPECIALIZATIONS
25 #if !(defined(_MSC_VER) && _MSC_VER == 1916 && defined(PYBIND11_CPP17))
40 function kill_f(std::move(
f));
50 template <
typename Return,
typename... Args>
56 return hfunc.
f(std::forward<Args>(
args)...).template cast<Return>();
62 template <
typename Return,
typename... Args>
64 using type = std::function<Return(Args...)>;
78 if (!isinstance<function>(src)) {
82 auto func = reinterpret_borrow<function>(src);
92 if (
auto cfunc =
func.cpp_function()) {
93 auto *cfunc_self = PyCFunction_GET_SELF(cfunc.ptr());
94 if (cfunc_self ==
nullptr) {
96 }
else if (isinstance<capsule>(cfunc_self)) {
97 auto c = reinterpret_borrow<capsule>(cfunc_self);
105 while (rec !=
nullptr) {
108 *
reinterpret_cast<const std::type_info *
>(rec->
data[1]))) {
123 value = type_caster_std_function_specializations::func_wrapper<Return, Args...>(
124 type_caster_std_function_specializations::func_handle(std::move(
func)));
128 template <
typename Func>
134 auto result = f_.template target<function_type>();
constexpr descr< N - 1 > const_name(char const (&text)[N])
return_value_policy
Approach used to cast a previously unknown C++ instance into a Python object.
Return operator()(Args... args) const
#define PYBIND11_NAMESPACE_END(name)
#define PYBIND11_NAMESPACE_BEGIN(name)
Return(*)(Args...) function_type
void * data[3]
Storage for the wrapped function pointer and captured data, if any.
typename std::conditional< B, T, F >::type conditional_t
bool same_type(const std::type_info &lhs, const std::type_info &rhs)
conditional_t< std::is_same< Return, void >::value, void_type, Return > retval_type
func_handle & operator=(const func_handle &f_)
func_handle(function &&f_) noexcept
function_record * next
Pointer to next overload.
func_wrapper_base(func_handle &&hf) noexcept
static handle cast(Func &&f_, return_value_policy policy, handle)
func_handle(const func_handle &f_)
constexpr descr< 0 > concat()
Wraps an arbitrary C++ function/method/lambda function/.. into a callable Python object.
bool is_function_record_capsule(const capsule &cap)
bool is_stateless
True if this is a stateless function pointer.
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
#define PYBIND11_TYPE_CASTER(type, py_name)
Helper type to replace 'void' in some expressions.
bool load(handle src, bool convert)
static BinaryMeasurement< Rot3 > convert(const BetweenFactor< Pose3 >::shared_ptr &f)
gtsam
Author(s):
autogenerated on Wed Mar 19 2025 03:01:41