24 value.arg =
"loading ArgInspector1 argument " +
25 std::string(convert ?
"WITH" :
"WITHOUT") +
" conversion allowed. " 26 "Argument value = " + (std::string)
str(src);
31 return str(src.
arg).release();
39 value.arg =
"loading ArgInspector2 argument " +
40 std::string(convert ?
"WITH" :
"WITHOUT") +
" conversion allowed. " 41 "Argument value = " + (std::string)
str(src);
46 return str(src.
arg).release();
58 return py::none().release();
80 return py::bool_(
true).release();
98 return a.
arg +
"\n" + b.
arg +
"\n" + std::to_string(c) +
"\n" + d->
arg;
102 py::class_<ArgInspector>(
m,
"ArgInspector")
111 m.def(
"floats_preferred", [](
double f) {
return 0.5 *
f; },
py::arg(
"f"));
112 m.def(
"floats_only", [](
double f) {
return 0.5 *
f; },
py::arg(
"f").noconvert());
113 m.def(
"ints_preferred", [](
int i) {
return i / 2; },
py::arg(
"i"));
114 m.def(
"ints_only", [](
int i) {
return i / 2; },
py::arg(
"i").noconvert());
123 py::return_value_policy::take_ownership);
125 py::return_value_policy::take_ownership);
126 m.def(
"destruction_tester_cstats", &ConstructorStats::get<DestructionTester>, py::return_value_policy::reference);
static handle cast(const ArgInspector1 &src, return_value_policy, handle)
bool load(handle src, bool convert)
TEST_SUBMODULE(custom_type_casters, m)
static handle cast(const ArgAlwaysConverts &, return_value_policy, handle)
bool load(handle src, bool convert)
DestructionTester(const DestructionTester &)
DestructionTester & operator=(DestructionTester &&)
void print_destroyed(T *inst, Values &&...values)
void print_copy_assigned(T *inst, Values &&...values)
void print_copy_created(T *inst, Values &&...values)
DestructionTester & operator=(const DestructionTester &)
void g(const string &key, int i)
static handle cast(const DestructionTester &, return_value_policy, handle)
void print_default_created(T *inst, Values &&...values)
void print_move_assigned(T *inst, Values &&...values)
bool convert(const int &y)
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
DestructionTester(DestructionTester &&)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const ArgReturnType arg() const
bool load(handle, bool convert)
static handle cast(const ArgInspector2 &src, return_value_policy, handle)
void print_move_created(T *inst, Values &&...values)
return_value_policy
Approach used to cast a previously unknown C++ instance into a Python object.
#define PYBIND11_TYPE_CASTER(type, py_name)