16 std::string
arg =
"(default arg inspector 1)";
20 std::string
arg =
"(default arg inspector 2)";
30 #ifdef PYBIND11_DETAIL_UNDERSCORE_BACKWARD_COMPATIBILITY 37 value.arg =
"loading ArgInspector1 argument " + std::string(convert ?
"WITH" :
"WITHOUT")
38 +
" conversion allowed. " 40 + (std::string)
str(src);
45 return str(src.
arg).release();
54 value.arg =
"loading ArgInspector2 argument " + std::string(convert ?
"WITH" :
"WITHOUT")
55 +
" conversion allowed. " 57 + (std::string)
str(src);
62 return str(src.
arg).release();
73 return py::none().release();
103 return py::bool_(
true).release();
117 namespace py_ = ::pybind11;
122 bool load(py_::handle,
bool) {
return true; }
125 return py_::bool_(
true).release();
153 return a.
arg +
"\n" + b.
arg +
"\n" + std::to_string(c) +
"\n" + d->
arg;
158 py::class_<ArgInspector>(
m,
"ArgInspector")
165 "c"_a.noconvert() = 13,
172 return a.
arg +
"\n" + b.
arg;
179 "floats_preferred", [](
double f) {
return 0.5 *
f; },
"f"_a);
181 "floats_only", [](
double f) {
return 0.5 *
f; },
"f"_a.noconvert());
183 "ints_preferred", [](
int i) {
return i / 2; },
"i"_a);
185 "ints_only", [](
int i) {
return i / 2; },
"i"_a.noconvert());
191 m.def(
"custom_caster_no_destroy", []() {
197 "custom_caster_destroy",
199 py::return_value_policy::take_ownership);
201 "custom_caster_destroy_const",
203 py::return_value_policy::take_ownership);
204 m.def(
"destruction_tester_cstats",
205 &ConstructorStats::get<DestructionTester>,
206 py::return_value_policy::reference);
static handle cast(const ArgInspector1 &src, return_value_policy, handle)
bool load(handle src, bool convert)
static py_::handle cast(const MyType &, py_::return_value_policy, py_::handle)
TEST_SUBMODULE(custom_type_casters, m)
static handle cast(const ArgAlwaysConverts &, return_value_policy, handle)
bool load(py_::handle, bool)
bool load(handle src, bool convert)
DestructionTester(const DestructionTester &)
DestructionTester & operator=(DestructionTester &&) noexcept
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)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const ArgReturnType arg() const
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
DestructionTester(DestructionTester &&) noexcept
constexpr descr< N - 1 > _(char const (&text)[N])
bool load(handle, bool convert)
static handle cast(const ArgInspector2 &src, return_value_policy, handle)
void print_move_created(T *inst, Values &&...values)
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
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)
static BinaryMeasurement< Rot3 > convert(const BetweenFactor< Pose3 >::shared_ptr &f)