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 (isinstance<capsule>(cfunc_self)) {
52 auto c = reinterpret_borrow<capsule>(cfunc_self);
55 while (rec !=
nullptr) {
58 *
reinterpret_cast<const std::type_info *
>(rec->data[1]))) {
76 #if !(defined(_MSC_VER) && _MSC_VER == 1916 && defined(PYBIND11_CPP17)) 80 func_handle(
function &&f_) noexcept
83 func_handle(
const func_handle &f_) { operator=(f_); }
84 func_handle &operator=(
const func_handle &f_) {
91 function kill_f(std::move(
f));
98 explicit func_wrapper(func_handle &&hf) noexcept : hfunc(std::move(hf)) {}
102 return hfunc.f(std::forward<Args>(
args)...).template cast<Return>();
106 value = func_wrapper(func_handle(std::move(
func)));
110 template <
typename Func>
116 auto result = f_.template target<function_type>();
typename std::conditional< B, T, F >::type conditional_t
static handle cast(Func &&f_, return_value_policy policy, handle)
conditional_t< std::is_same< Return, void >::value, void_type, Return > retval_type
bool load(handle src, bool convert)
#define PYBIND11_NAMESPACE
bool same_type(const std::type_info &lhs, const std::type_info &rhs)
const handle & inc_ref() const &
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
constexpr descr< 0 > concat()
Helper type to replace 'void' in some expressions.
Wraps an arbitrary C++ function/method/lambda function/.. into a callable Python object.
Return(*)(Args...) function_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
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_TYPE_CASTER(type, py_name)
#define PYBIND11_NAMESPACE_END(name)
static BinaryMeasurement< Rot3 > convert(const BetweenFactor< Pose3 >::shared_ptr &f)
#define PYBIND11_NAMESPACE_BEGIN(name)