Go to the documentation of this file.
19 template <
typename Return,
typename... Args>
21 using type = std::function<Return(Args...)>;
35 if (!isinstance<function>(src)) {
39 auto func = reinterpret_borrow<function>(src);
49 if (
auto cfunc =
func.cpp_function()) {
50 auto *cfunc_self = PyCFunction_GET_SELF(cfunc.ptr());
51 if (cfunc_self ==
nullptr) {
53 }
else if (isinstance<capsule>(cfunc_self)) {
54 auto c = reinterpret_borrow<capsule>(cfunc_self);
62 while (rec !=
nullptr) {
65 *
reinterpret_cast<const std::type_info *
>(rec->
data[1]))) {
83 #if !(defined(_MSC_VER) && _MSC_VER == 1916 && defined(PYBIND11_CPP17))
87 func_handle(
function &&f_) noexcept
90 func_handle(
const func_handle &f_) { operator=(f_); }
91 func_handle &operator=(
const func_handle &f_) {
98 function kill_f(std::move(
f));
103 struct func_wrapper {
105 explicit func_wrapper(func_handle &&hf) noexcept : hfunc(std::move(hf)) {}
109 return hfunc.f(std::forward<Args>(
args)...).template cast<Return>();
113 value = func_wrapper(func_handle(std::move(
func)));
117 template <
typename Func>
123 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.
#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
internal::enable_if< internal::valid_indexed_view_overload< RowIndices, ColIndices >::value &&internal::traits< typename EIGEN_INDEXED_VIEW_METHOD_TYPE< RowIndices, ColIndices >::type >::ReturnAsIndexedView, typename EIGEN_INDEXED_VIEW_METHOD_TYPE< RowIndices, ColIndices >::type >::type operator()(const RowIndices &rowIndices, const ColIndices &colIndices) EIGEN_INDEXED_VIEW_METHOD_CONST
function_record * next
Pointer to next overload.
static handle cast(Func &&f_, return_value_policy policy, handle)
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 Sat Nov 16 2024 04:02:19