20 #include <type_traits> 22 #if defined(PYBIND11_CPP17) 23 # if defined(__has_include) 24 # if __has_include(<string_view>) 25 # define PYBIND11_HAS_STRING_VIEW 27 # elif defined(_MSC_VER) 28 # define PYBIND11_HAS_STRING_VIEW 31 #ifdef PYBIND11_HAS_STRING_VIEW 32 #include <string_view> 35 #if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L 36 # define PYBIND11_HAS_U8STRING 63 stack.shrink_to_fit();
71 throw cast_error(
"When called outside a bound function, py::cast() cannot " 72 "do Python -> C++ conversions which require the creation " 73 "of temporary values");
75 auto &list_ptr =
stack.back();
76 if (list_ptr ==
nullptr) {
77 list_ptr = PyList_New(1);
80 PyList_SET_ITEM(list_ptr, 0, h.
inc_ref().
ptr());
82 auto result = PyList_Append(list_ptr, h.
ptr());
96 std::vector<PyTypeObject *>
check;
97 for (
handle parent : reinterpret_borrow<tuple>(t->tp_bases))
98 check.push_back((PyTypeObject *) parent.ptr());
101 for (
size_t i = 0;
i < check.size();
i++) {
102 auto type = check[
i];
104 if (!PyType_Check((PyObject *)
type))
continue;
107 auto it = type_dict.find(
type);
108 if (it != type_dict.end()) {
113 for (
auto *tinfo : it->second) {
118 for (
auto *known : bases) {
119 if (known == tinfo) { found =
true;
break; }
121 if (!found) bases.push_back(tinfo);
124 else if (
type->tp_bases) {
127 if (
i + 1 == check.size()) {
134 for (
handle parent : reinterpret_borrow<tuple>(
type->tp_bases))
135 check.push_back((PyTypeObject *) parent.ptr());
156 return ins.first->second;
168 if (bases.size() > 1)
169 pybind11_fail(
"pybind11::detail::get_type_info: type has multiple pybind11-registered bases");
170 return bases.front();
175 auto it = locals.find(tp);
176 if (it != locals.end())
183 auto it = types.find(tp);
184 if (it != types.end())
191 bool throw_if_missing =
false) {
197 if (throw_if_missing) {
198 std::string tname = tp.name();
200 pybind11_fail(
"pybind11::detail::get_type_info: unable to find type info for \"" + tname +
"\"");
207 return handle(type_info ? ((PyObject *) type_info->type) :
nullptr);
213 const detail::type_info *
type =
nullptr;
218 inst{i}, index{index}, type{type},
229 return reinterpret_cast<V *&
>(vh[0]);
235 return reinterpret_cast<H &
>(vh[1]);
282 : inst{inst}, types{tinfo},
284 types->empty() ?
nullptr : (*types)[0] ,
295 curr.
vh += 1 + (*types)[curr.
index]->holder_size_in_ptrs;
297 curr.
type = curr.
index < types->size() ? (*types)[curr.
index] :
nullptr;
309 while (it != endit && it->type != find_type) ++it;
313 size_t size() {
return tinfo.size(); }
328 if (!find_type || Py_TYPE(
this) == find_type->
type)
331 detail::values_and_holders vhs(
this);
332 auto it = vhs.find(find_type);
336 if (!throw_if_missing)
340 pybind11_fail(
"pybind11::detail::instance::get_value_and_holder: " 341 "type is not a pybind11 base of the given instance " 342 "(compile in debug mode for type details)");
344 pybind11_fail(
"pybind11::detail::instance::get_value_and_holder: `" +
345 std::string(find_type->
type->tp_name) +
"' is not a pybind11 base of the given `" +
346 std::string(Py_TYPE(
this)->tp_name) +
"' instance");
353 const size_t n_types =
tinfo.size();
356 pybind11_fail(
"instance allocation failed: new instance has no pybind11-registered base types");
363 simple_value_holder[0] =
nullptr;
364 simple_holder_constructed =
false;
365 simple_instance_registered =
false;
375 space +=
t->holder_size_in_ptrs;
377 size_t flags_at = space;
385 #if PY_VERSION_HEX >= 0x03050000 386 nonsimple.values_and_holders = (
void **) PyMem_Calloc(space,
sizeof(
void *));
387 if (!nonsimple.values_and_holders)
throw std::bad_alloc();
389 nonsimple.values_and_holders = (
void **) PyMem_New(
void *, space);
390 if (!nonsimple.values_and_holders)
throw std::bad_alloc();
391 std::memset(nonsimple.values_and_holders, 0, space *
sizeof(
void *));
393 nonsimple.status =
reinterpret_cast<uint8_t *
>(&nonsimple.values_and_holders[flags_at]);
400 PyMem_Free(nonsimple.values_and_holders);
411 if (!PyErr_Occurred()) {
412 PyErr_SetString(PyExc_RuntimeError,
"Unknown internal error occurred");
413 return "Unknown internal error occurred";
418 std::string errorString;
420 errorString +=
handle(scope.
type).attr(
"__name__").
cast<std::string>();
424 errorString += (std::string)
str(scope.
value);
426 PyErr_NormalizeException(&scope.
type, &scope.
value, &scope.
trace);
428 #if PY_MAJOR_VERSION >= 3 429 if (scope.
trace !=
nullptr)
430 PyException_SetTraceback(scope.
value, scope.
trace);
433 #if !defined(PYPY_VERSION) 435 auto *trace = (PyTracebackObject *) scope.
trace;
438 while (trace->tb_next)
439 trace = trace->tb_next;
441 PyFrameObject *frame = trace->tb_frame;
442 errorString +=
"\n\nAt:\n";
444 int lineno = PyFrame_GetLineNumber(frame);
446 " " +
handle(frame->f_code->co_filename).
cast<std::string>() +
447 "(" + std::to_string(lineno) +
"): " +
448 handle(frame->f_code->co_name).
cast<std::string>() +
"\n";
449 frame = frame->f_back;
459 auto range = instances.equal_range(ptr);
460 for (
auto it = range.first; it != range.second; ++it) {
463 return handle((PyObject *) it->second);
470 #if defined(PYPY_VERSION) 471 return PyThreadState_GET();
472 #elif PY_VERSION_HEX < 0x03000000 473 return _PyThreadState_Current;
474 #elif PY_VERSION_HEX < 0x03050000 475 return (PyThreadState*) _Py_atomic_load_relaxed(&_PyThreadState_Current);
476 #elif PY_VERSION_HEX < 0x03050200 477 return (PyThreadState*) _PyThreadState_Current.value;
479 return _PyThreadState_UncheckedGet();
490 : typeinfo(
get_type_info(type_info)), cpptype(&type_info) { }
493 : typeinfo(typeinfo), cpptype(typeinfo ? typeinfo->cpptype : nullptr) { }
496 return load_impl<type_caster_generic>(src,
convert);
500 const detail::type_info *tinfo,
501 void *(*copy_constructor)(
const void *),
502 void *(*move_constructor)(
const void *),
503 const void *existing_holder =
nullptr) {
507 void *src =
const_cast<void *
>(_src);
512 for (
auto it_i = it_instances.first; it_i != it_instances.second; ++it_i) {
514 if (instance_type &&
same_type(*instance_type->cpptype, *tinfo->cpptype))
521 wrapper->
owned =
false;
528 wrapper->owned =
true;
534 wrapper->owned =
false;
538 if (copy_constructor)
539 valueptr = copy_constructor(src);
542 throw cast_error(
"return_value_policy = copy, but type is " 543 "non-copyable! (compile in debug mode for details)");
545 std::string
type_name(tinfo->cpptype->name());
547 throw cast_error(
"return_value_policy = copy, but type " +
551 wrapper->owned =
true;
555 if (move_constructor)
556 valueptr = move_constructor(src);
557 else if (copy_constructor)
558 valueptr = copy_constructor(src);
561 throw cast_error(
"return_value_policy = move, but type is neither " 562 "movable nor copyable! " 563 "(compile in debug mode for details)");
565 std::string
type_name(tinfo->cpptype->name());
567 throw cast_error(
"return_value_policy = move, but type " +
568 type_name +
" is neither movable nor copyable!");
571 wrapper->owned =
true;
576 wrapper->owned =
false;
581 throw cast_error(
"unhandled return_value_policy: should not happen!");
584 tinfo->init_instance(wrapper, existing_holder);
586 return inst.release();
591 auto *&vptr = v_h.value_ptr();
593 if (vptr ==
nullptr) {
594 auto *
type = v_h.type ? v_h.type : typeinfo;
595 if (
type->operator_new) {
596 vptr =
type->operator_new(
type->type_size);
598 #if defined(__cpp_aligned_new) && (!defined(_MSC_VER) || _MSC_VER >= 1912) 599 if (
type->type_align > __STDCPP_DEFAULT_NEW_ALIGNMENT__)
600 vptr = ::operator
new(
type->type_size,
601 std::align_val_t(
type->type_align));
604 vptr = ::operator
new(
type->type_size);
610 for (
auto &
cast : typeinfo->implicit_casts) {
612 if (sub_caster.
load(src, convert)) {
620 for (
auto &converter : *typeinfo->direct_conversions) {
630 if (caster.load(src,
false))
640 if (!
hasattr(pytype, local_key))
643 type_info *foreign_typeinfo = reinterpret_borrow<capsule>(
getattr(pytype, local_key));
659 template <
typename ThisT>
661 if (!src)
return false;
662 if (!typeinfo)
return try_load_foreign_module_local(src);
665 if (!convert)
return false;
670 auto &this_ =
static_cast<ThisT &
>(*this);
671 this_.check_holder_compat();
673 PyTypeObject *srctype = Py_TYPE(src.
ptr());
677 if (srctype == typeinfo->type) {
678 this_.load_value(reinterpret_cast<instance *>(src.
ptr())->get_value_and_holder());
682 else if (PyType_IsSubtype(srctype, typeinfo->type)) {
684 bool no_cpp_mi = typeinfo->simple_type;
692 if (bases.size() == 1 && (no_cpp_mi || bases.front()->type == typeinfo->type)) {
693 this_.load_value(reinterpret_cast<instance *>(src.
ptr())->get_value_and_holder());
699 else if (bases.size() > 1) {
700 for (
auto base : bases) {
701 if (no_cpp_mi ? PyType_IsSubtype(
base->type, typeinfo->type) :
base->type == typeinfo->type) {
702 this_.load_value(reinterpret_cast<instance *>(src.
ptr())->get_value_and_holder(
base));
711 if (this_.try_implicit_casts(src, convert))
717 for (
auto &converter : typeinfo->implicit_conversions) {
718 auto temp = reinterpret_steal<object>(converter(src.
ptr(), typeinfo->type));
719 if (load_impl<ThisT>(temp,
false)) {
724 if (this_.try_direct_conversions(src))
729 if (typeinfo->module_local) {
732 return load(src,
false);
737 return try_load_foreign_module_local(src);
745 const void *src,
const std::type_info &cast_type,
const std::type_info *rtti_type =
nullptr) {
747 return {src,
const_cast<const type_info *
>(tpi)};
750 std::string tname = rtti_type ? rtti_type->name() : cast_type.name();
752 std::string
msg =
"Unregistered type : " + tname;
753 PyErr_SetString(PyExc_TypeError, msg.c_str());
754 return {
nullptr,
nullptr};
758 const std::type_info *cpptype =
nullptr;
769 template <
typename T>
772 typename std::add_pointer<intrinsic_t<T>>
::type,
773 typename std::add_lvalue_reference<intrinsic_t<T>>::type>;
782 template <
typename T>
785 typename std::add_pointer<intrinsic_t<T>>
::type,
787 typename std::add_rvalue_reference<intrinsic_t<T>>
::type,
788 typename std::add_lvalue_reference<intrinsic_t<T>>::type>>;
799 std::is_same<typename Container::value_type &, typename Container::reference>,
801 negation<std::is_same<Container, typename Container::value_type>>
808 :
all_of<is_copy_constructible<T1>, is_copy_constructible<T2>> {};
811 template <
typename T,
typename SFINAE =
void>
struct is_copy_assignable : std::is_copy_assignable<T> {};
814 std::is_same<typename Container::value_type &, typename Container::reference>
817 :
all_of<is_copy_assignable<T1>, is_copy_assignable<T2>> {};
842 template <
typename itype,
typename SFINAE =
void>
845 static const void *
get(
const itype *src,
const std::type_info*&) {
return src; }
847 template <
typename itype>
850 static const void *
get(
const itype *src,
const std::type_info*&
type) {
851 type = src ? &
typeid(*src) :
nullptr;
852 return dynamic_cast<const void*
>(src);
855 template <
typename itype,
typename SFINAE =
void>
865 static constexpr
auto name = _<type>();
873 return cast(&src, policy, parent);
884 auto &cast_type =
typeid(
itype);
885 const std::type_info *instance_type =
nullptr;
887 if (instance_type && !
same_type(cast_type, *instance_type)) {
905 auto st = src_and_type(src);
907 st.first, policy, parent, st.second,
908 make_copy_constructor(src), make_move_constructor(src));
912 auto st = src_and_type(src);
915 nullptr,
nullptr, holder);
930 return [](
const void *
arg) ->
void * {
931 return new T(*reinterpret_cast<const T *>(
arg));
937 return [](
const void *
arg) ->
void * {
938 return new T(std::move(*const_cast<T *>(reinterpret_cast<const T *>(
arg))));
955 return std::move(caster).operator
959 template <
typename type>
class type_caster<std::reference_wrapper<type>> {
965 "std::reference_wrapper<T> caster requires T to have a caster with an `T &` operator");
975 template <
typename T>
using cast_op_type = std::reference_wrapper<type>;
979 #define PYBIND11_TYPE_CASTER(type, py_name) \ 983 static constexpr auto name = py_name; \ 984 template <typename T_, enable_if_t<std::is_same<type, remove_cv_t<T_>>::value, int> = 0> \ 985 static handle cast(T_ *src, return_value_policy policy, handle parent) { \ 986 if (!src) return none().release(); \ 987 if (policy == return_value_policy::take_ownership) { \ 988 auto h = cast(std::move(*src), policy, parent); delete src; return h; \ 990 return cast(*src, policy, parent); \ 993 operator type*() { return &value; } \ 994 operator type&() { return value; } \ 995 operator type&&() && { return std::move(value); } \ 996 template <typename T_> using cast_op_type = pybind11::detail::movable_cast_op_type<T_> 1000 std::is_same<CharT, char>,
1001 #if defined(PYBIND11_HAS_U8STRING) 1002 std::is_same<CharT, char8_t>,
1004 std::is_same<CharT, char16_t>,
1005 std::is_same<CharT, char32_t>,
1006 std::is_same<CharT, wchar_t>
1010 template <
typename T>
1024 if (convert || PyFloat_Check(src.
ptr()))
1025 py_value = (
py_type) PyFloat_AsDouble(src.
ptr());
1028 }
else if (PyFloat_Check(src.
ptr())) {
1031 py_value = as_unsigned<py_type>(src.
ptr());
1033 py_value =
sizeof(
T) <=
sizeof(
long)
1039 bool py_err = py_value == (
py_type) -1 && PyErr_Occurred();
1044 bool type_error = py_err && PyErr_ExceptionMatches(
1045 #
if PY_VERSION_HEX < 0x03000000 && !defined(PYPY_VERSION)
1052 if (type_error && convert && PyNumber_Check(src.
ptr())) {
1054 ? PyNumber_Float(src.
ptr())
1055 : PyNumber_Long(src.
ptr()));
1057 return load(tmp,
false);
1066 template<
typename U = T>
1069 return PyFloat_FromDouble((
double) src);
1072 template<
typename U = T>
1078 template<
typename U = T>
1084 template<
typename U = T>
1087 return PyLong_FromLongLong((
long long) src);
1090 template<
typename U = T>
1093 return PyLong_FromUnsignedLongLong((
unsigned long long) src);
1102 if (src && src.is_none())
1121 }
else if (h.is_none()) {
1127 if (isinstance<capsule>(h)) {
1128 value = reinterpret_borrow<capsule>(
h);
1134 if (bases.size() == 1) {
1152 static constexpr
auto name =
_(
"capsule");
1162 if (!src)
return false;
1163 else if (src.
ptr() == Py_True) {
value =
true;
return true; }
1164 else if (src.
ptr() == Py_False) {
value =
false;
return true; }
1165 else if (convert || !strcmp(
"numpy.bool_", Py_TYPE(src.
ptr())->tp_name)) {
1168 Py_ssize_t
res = -1;
1169 if (src.is_none()) {
1172 #if defined(PYPY_VERSION) 1175 res = PyObject_IsTrue(src.
ptr());
1180 else if (
auto tp_as_number = src.
ptr()->ob_type->tp_as_number) {
1186 if (res == 0 || res == 1) {
1203 using CharT =
typename StringType::value_type;
1208 #if defined(PYBIND11_HAS_U8STRING) 1215 "Unsupported wchar_t size != 2/4");
1216 static constexpr
size_t UTF_N = 8 *
sizeof(
CharT);
1219 #if PY_MAJOR_VERSION < 3 1225 }
else if (!PyUnicode_Check(load_src.
ptr())) {
1226 #if PY_MAJOR_VERSION >= 3 1227 return load_bytes(load_src);
1230 return load_bytes(load_src);
1237 temp = reinterpret_steal<object>(PyUnicode_FromObject(load_src.
ptr()));
1238 if (!temp) { PyErr_Clear();
return false; }
1243 object utfNbytes = reinterpret_steal<object>(PyUnicode_AsEncodedString(
1244 load_src.
ptr(), UTF_N == 8 ?
"utf-8" : UTF_N == 16 ?
"utf-16" :
"utf-32",
nullptr));
1245 if (!utfNbytes) { PyErr_Clear();
return false; }
1249 if (UTF_N > 8) {
buffer++; length--; }
1260 const char *
buffer =
reinterpret_cast<const char *
>(src.data());
1262 handle s = decode_utfN(buffer, nbytes);
1271 #if !defined(PYPY_VERSION) 1273 UTF_N == 8 ? PyUnicode_DecodeUTF8(buffer, nbytes,
nullptr) :
1274 UTF_N == 16 ? PyUnicode_DecodeUTF16(buffer, nbytes,
nullptr,
nullptr) :
1275 PyUnicode_DecodeUTF32(buffer, nbytes,
nullptr,
nullptr);
1281 return PyUnicode_Decode(buffer, nbytes, UTF_N == 8 ?
"utf-8" : UTF_N == 16 ?
"utf-16" :
"utf-32",
nullptr);
1288 template <
typename C = CharT>
1303 template <
typename C = CharT>
1307 template <
typename CharT,
class Traits,
class Allocator>
1309 :
string_caster<std::basic_string<CharT, Traits, Allocator>> {};
1311 #ifdef PYBIND11_HAS_STRING_VIEW 1312 template <
typename CharT,
class Traits>
1314 :
string_caster<std::basic_string_view<CharT, Traits>, true> {};
1327 if (!src)
return false;
1328 if (src.is_none()) {
1330 if (!convert)
return false;
1334 return str_caster.
load(src, convert);
1338 if (src ==
nullptr)
return pybind11::none().
inc_ref();
1344 handle s = PyUnicode_DecodeLatin1((
const char *) &src, 1,
nullptr);
1351 operator CharT*() {
return none ?
nullptr :
const_cast<CharT *
>(
static_cast<StringType &
>(str_caster).
c_str()); }
1354 throw value_error(
"Cannot convert None to a character");
1357 size_t str_len =
value.size();
1359 throw value_error(
"Cannot convert empty string to a character");
1366 if (StringCaster::UTF_N == 8 && str_len > 1 && str_len <= 4) {
1367 auto v0 =
static_cast<unsigned char>(
value[0]);
1368 size_t char0_bytes = !(
v0 & 0x80) ? 1 :
1369 (
v0 & 0xE0) == 0xC0 ? 2 :
1370 (
v0 & 0xF0) == 0xE0 ? 3 :
1373 if (char0_bytes == str_len) {
1375 if (char0_bytes == 2 && (
v0 & 0xFC) == 0xC0) {
1376 one_char =
static_cast<CharT
>(((
v0 & 3) << 6) + (
static_cast<unsigned char>(
value[1]) & 0x3F));
1380 throw value_error(
"Character code point not in range(0x100)");
1387 else if (StringCaster::UTF_N == 16 && str_len == 2) {
1388 one_char =
static_cast<CharT
>(
value[0]);
1389 if (one_char >= 0xD800 && one_char < 0xE000)
1390 throw value_error(
"Character code point not in range(0x10000)");
1394 throw value_error(
"Expected a character, but multi-character string found");
1396 one_char =
value[0];
1401 template <
typename _T>
using cast_op_type = pybind11::detail::cast_op_type<_T>;
1405 template <
template<
typename...>
class Tuple,
typename... Ts>
class tuple_caster {
1407 static constexpr
auto size =
sizeof...(Ts);
1412 if (!isinstance<sequence>(src))
1414 const auto seq = reinterpret_borrow<sequence>(src);
1415 if (seq.size() !=
size)
1417 return load_impl(seq, convert,
indices{});
1420 template <
typename T>
1422 return cast_impl(std::forward<T>(src), policy, parent,
indices{});
1426 template <
typename T>
1430 auto h =
cast(std::move(*src), policy, parent);
delete src;
return h;
1432 return cast(*src, policy, parent);
1441 operator type() && {
return std::move(*this).implicit_cast(
indices{}); }
1444 template <
size_t... Is>
1446 template <
size_t... Is>
1451 template <
size_t... Is>
1453 #ifdef __cpp_fold_expressions 1454 if ((... || !std::get<Is>(subcasters).
load(seq[Is], convert)))
1457 for (
bool r : {std::get<Is>(subcasters).
load(seq[Is], convert)...})
1465 template <
typename T,
size_t... Is>
1467 std::array<object, size> entries{{
1468 reinterpret_steal<object>(
make_caster<Ts>::cast(std::get<Is>(std::forward<T>(src)), policy, parent))...
1470 for (
const auto &entry: entries)
1475 for (
auto & entry: entries)
1476 PyTuple_SET_ITEM(result.
ptr(), counter++, entry.release().ptr());
1483 template <
typename T1,
typename T2>
class type_caster<std::pair<T1, T2>>
1491 template <
typename T>
1493 static auto get(
const T &
p) -> decltype(
p.get()) {
return p.get(); }
1497 template <
typename type,
typename holder_type>
1502 "Holder classes are only supported for custom types");
1505 using base::typeinfo;
1509 return base::template load_impl<copyable_holder_caster<type, holder_type>>(src,
convert);
1516 explicit operator holder_type*() {
return std::addressof(
holder); }
1520 #if defined(__ICC) || defined(__INTEL_COMPILER) 1521 operator holder_type&() {
return holder; }
1523 explicit operator holder_type&() {
return holder; }
1535 throw cast_error(
"Unable to load a custom holder type from a default-holder instance");
1539 if (v_h.holder_constructed()) {
1540 value = v_h.value_ptr();
1541 holder = v_h.template holder<holder_type>();
1544 throw cast_error(
"Unable to cast from non-held to held instance (T& to Holder<T>) " 1546 "(compile in debug mode for type information)");
1548 "of type '" + type_id<holder_type>() +
"''");
1560 if (sub_caster.
load(src, convert)) {
1576 template <
typename T>
1579 template <
typename type,
typename holder_type>
1582 "Holder classes are only supported for custom types");
1591 template <
typename type,
typename deleter>
1595 template <
typename type,
typename holder_type>
1603 #define PYBIND11_DECLARE_HOLDER_TYPE(type, holder_type, ...) \ 1604 namespace pybind11 { namespace detail { \ 1605 template <typename type> \ 1606 struct always_construct_holder<holder_type> : always_construct_holder<void, ##__VA_ARGS__> { }; \ 1607 template <typename type> \ 1608 class type_caster<holder_type, enable_if_t<!is_shared_ptr<holder_type>::value>> \ 1609 : public type_caster_holder<type, holder_type> { }; \ 1614 std::is_base_of<detail::type_caster_holder<base, holder>, detail::type_caster<holder>> {};
1628 template <
typename type>
1635 if (!isinstance<type>(src))
1637 value = reinterpret_borrow<type>(src);
1647 template <
typename T>
1660 std::is_void, std::is_pointer, std::is_reference, std::is_const
1662 template <
typename T,
typename SFINAE =
void>
struct move_always : std::false_type {};
1666 std::is_move_constructible<T>,
1667 std::is_same<decltype(std::declval<make_caster<T>>().operator T&()), T&>
1668 >::value>> : std::true_type {};
1673 std::is_move_constructible<T>,
1674 std::is_same<decltype(std::declval<make_caster<T>>().operator T&()), T&>
1675 >::value>> : std::true_type {};
1696 detail::
enable_if_t<std::is_base_of<type_caster_generic, make_caster<Return>>::value, void>> {
1706 if (!conv.
load(handle,
true)) {
1708 throw cast_error(
"Unable to cast Python instance to C++ type (compile in debug mode for details)");
1710 throw cast_error(
"Unable to cast Python instance of type " +
1730 "Unable to cast type to reference: value is local to type caster");
1731 return cast_op<T>(load_type<T>(handle));
1741 handle parent = handle()) {
1752 template <
typename T> T
handle::cast()
const {
return pybind11::cast<T>(*this); }
1755 template <
typename T>
1757 if (obj.ref_count() > 1)
1759 throw cast_error(
"Unable to cast Python instance to C++ rvalue: instance has multiple references" 1760 " (compile in debug mode for details)");
1762 throw cast_error(
"Unable to move from Python " + (std::string)
str(
type::handle_of(obj)) +
1763 " instance to C++ " + type_id<T>() +
" instance: instance has multiple references");
1767 T
ret = std::move(detail::load_type<T>(obj).
operator T&());
1777 return move<T>(std::move(
object));
1780 if (
object.ref_count() > 1)
1783 return move<T>(std::move(
object));
1789 template <
typename T> T
object::cast() const & {
return pybind11::cast<T>(*this); }
1790 template <
typename T> T
object::cast() && {
return pybind11::cast<T>(std::move(*
this)); }
1807 return cast_op<T>(
load_type(caster, o));
1810 pybind11_fail(
"Internal error: cast_ref fallback invoked"); }
1816 return pybind11::cast<T>(std::move(o)); }
1818 pybind11_fail(
"Internal error: cast_safe fallback invoked"); }
1823 template <return_value_policy policy = return_value_policy::automatic_reference>
1828 constexpr
size_t size =
sizeof...(Args);
1829 std::array<object, size>
args {
1831 std::forward<Args>(args_), policy,
nullptr))... }
1836 throw cast_error(
"make_tuple(): unable to convert arguments to Python object (compile in debug mode for details)");
1838 std::array<std::string, size> argtypes { {type_id<Args>()...} };
1839 throw cast_error(
"make_tuple(): unable to convert argument of type '" +
1840 argtypes[i] +
"' to Python object");
1846 for (
auto &arg_value :
args)
1847 PyTuple_SET_ITEM(result.
ptr(), counter++, arg_value.release().ptr());
1855 constexpr
explicit arg(
const char *name =
nullptr) : name(name), flag_noconvert(false), flag_none(true) { }
1857 template <
typename T>
arg_v operator=(T &&
value)
const;
1861 arg &
none(
bool flag =
true) { flag_none = flag;
return *
this; }
1864 bool flag_noconvert : 1;
1872 template <
typename T>
1879 #if !defined(NDEBUG) 1880 ,
type(type_id<T>())
1886 template <
typename T>
1891 template <
typename T>
1905 #if !defined(NDEBUG) 1921 template <
typename T>
1931 constexpr
arg operator"" _a(
const char *name,
size_t) {
return arg(name); }
1965 template <
typename... Args>
1973 kwargs_pos = constexpr_first<argument_is_kwargs, Args...>() - (
int)
sizeof...(Args);
1975 static constexpr
bool args_kwargs_are_last = kwargs_pos >= - 1 && args_pos >= kwargs_pos - 1;
1977 static_assert(args_kwargs_are_last,
"py::args/py::kwargs are only permitted as the last argument(s) of a function");
1980 static constexpr
bool has_kwargs = kwargs_pos < 0;
1981 static constexpr
bool has_args = args_pos < 0;
1986 return load_impl_sequence(call,
indices{});
1989 template <
typename Return,
typename Guard,
typename Func>
1991 return std::move(*this).template call_impl<Return>(std::forward<Func>(
f),
indices{}, Guard{});
1994 template <
typename Return,
typename Guard,
typename Func>
1996 std::move(*this).template call_impl<Return>(std::forward<Func>(
f),
indices{}, Guard{});
2004 template <
size_t... Is>
2006 #ifdef __cpp_fold_expressions 2017 template <
typename Return,
typename Func,
size_t... Is,
typename Guard>
2019 return std::forward<Func>(
f)(cast_op<Args>(std::move(std::get<Is>(argcasters)))...);
2027 template <return_value_policy policy>
2030 template <
typename... Ts>
2041 PyObject *
result = PyObject_CallObject(ptr, m_args.ptr());
2044 return reinterpret_steal<object>(
result);
2052 template <return_value_policy policy>
2055 template <
typename... Ts>
2059 auto args_list = list();
2060 int _[] = { 0, (process(args_list, std::forward<Ts>(
values)), 0)... };
2063 m_args = std::move(args_list);
2074 PyObject *
result = PyObject_Call(ptr, m_args.ptr(), m_kwargs.ptr());
2077 return reinterpret_steal<object>(
result);
2081 template <
typename T>
2086 argument_cast_error();
2088 argument_cast_error(std::to_string(args_list.size()), type_id<T>());
2091 args_list.append(o);
2094 void process(list &args_list, detail::args_proxy ap) {
2095 for (
const auto &
a : ap)
2096 args_list.append(
a);
2102 nameless_argument_error();
2104 nameless_argument_error(a.
type);
2107 if (m_kwargs.contains(a.
name)) {
2109 multiple_values_error();
2111 multiple_values_error(a.
name);
2116 argument_cast_error();
2118 argument_cast_error(a.
name, a.
type);
2127 for (
const auto &k : reinterpret_borrow<dict>(kp)) {
2128 if (m_kwargs.contains(k.first)) {
2130 multiple_values_error();
2132 multiple_values_error(
str(k.first));
2135 m_kwargs[k.first] = k.second;
2140 throw type_error(
"Got kwargs without a name; only named arguments " 2141 "may be passed via py::arg() to a python function call. " 2142 "(compile in debug mode for details)");
2145 throw type_error(
"Got kwargs without a name of type '" + type +
"'; only named " 2146 "arguments may be passed via py::arg() to a python function call. ");
2149 throw type_error(
"Got multiple values for keyword argument " 2150 "(compile in debug mode for details)");
2154 throw type_error(
"Got multiple values for keyword argument '" + name +
"'");
2158 throw cast_error(
"Unable to convert call argument to Python object " 2159 "(compile in debug mode for details)");
2163 throw cast_error(
"Unable to convert call argument '" + name
2164 +
"' of type '" + type +
"' to Python object");
2185 constexpr_last<is_positional, Args...>() < constexpr_first<is_keyword_or_ds, Args...>()
2186 && constexpr_last<is_s_unpacking, Args...>() < constexpr_first<is_ds_unpacking, Args...>(),
2187 "Invalid function call: positional args must precede keywords and ** unpacking; " 2188 "* unpacking must precede ** unpacking" 2193 template <
typename Derived>
2196 return detail::collect_arguments<policy>(std::forward<Args>(
args)...).call(derived().
ptr());
2199 template <
typename Derived>
2201 object object_api<Derived>::call(Args &&...args)
const {
2202 return operator()<policy>(std::forward<Args>(
args)...);
2208 template<
typename T>
2211 std::is_base_of<detail::type_caster_generic, detail::make_caster<T>>::
value,
2212 "py::type::of<T> only supports the case where T is a registered C++ types." 2219 #define PYBIND11_MAKE_OPAQUE(...) \ 2220 namespace pybind11 { namespace detail { \ 2221 template<> class type_caster<__VA_ARGS__> : public type_caster_base<__VA_ARGS__> { }; \ 2226 #define PYBIND11_TYPE(...) __VA_ARGS__ typename std::conditional< B, T, F >::type conditional_t
bool simple_holder_constructed
For simple layout, tracks whether the holder has been constructed.
static handle cast(T &&src, return_value_policy policy, handle parent)
void *(*)(const void *) Constructor
void ignore_unused(const int *)
Ignore that a variable is unused in compiler warnings.
std::reference_wrapper< type > cast_op_type
void deallocate_layout()
Destroys/deallocates all of the above.
static constexpr uint8_t status_holder_constructed
Bit values for the non-simple status flags.
object object_or_cast(T &&o)
const detail::type_info * type
bool load_args(function_call &call)
static constexpr bool load_impl(const sequence &, bool, index_sequence<>)
static void nameless_argument_error(std::string type)
static handle handle_of()
void keep_alive_impl(handle nurse, handle patient)
std::vector< PyObject * > loader_patient_stack
bool hasattr(handle obj, handle name)
static std::enable_if<!std::is_floating_point< U >::value &&std::is_signed< U >::value &&(sizeof(U) > sizeof(long)), handle >::type cast(U src, return_value_policy, handle)
static auto get(const T &p) -> decltype(p.get())
void process(list &, arg_v a)
bool load_impl(const sequence &seq, bool convert, index_sequence< Is... >)
bool load_impl_sequence(function_call &call, index_sequence< Is... >)
value_and_holder(size_t index)
detail::type_info * get_global_type_info(const std::type_index &tp)
enable_if_t<!std::is_void< Return >::value, Return > call(Func &&f)&&
arg & none(bool flag=true)
Indicates that the argument should/shouldn't allow None (e.g. for nullable pointer args) ...
constexpr size_t instance_simple_holder_in_ptrs()
bool load_bytes(enable_if_t< std::is_same< C, char >::value, handle > src)
bool load_bytes(enable_if_t<!std::is_same< C, char >::value, handle >)
std::vector< handle > args
Arguments passed to the function:
detail::cast_op_type< T > cast_op_type
static std::enable_if<!std::is_floating_point< U >::value &&std::is_unsigned< U >::value &&(sizeof(U)<=sizeof(unsigned long)), handle >::type cast(U src, return_value_policy, handle)
static Constructor make_copy_constructor(...)
void set_holder_constructed(bool v=true)
bool instance_registered() const
object call(PyObject *ptr) const
Call a Python function and pass the collected arguments.
bool load(handle src, bool convert)
PyObject * ptr() const
Return the underlying PyObject * pointer.
static handle cast_holder(const itype *src, const void *holder)
std::vector< detail::type_info * > type_vec
type_map< type_info * > & registered_local_types_cpp()
Works like internals.registered_types_cpp, but for module-local registered types: ...
#define PYBIND11_NB_BOOL(ptr)
static bool try_direct_conversions(handle)
void load_value(value_and_holder &&v_h)
const type_info * typeinfo
static auto make_move_constructor(const T *x) -> decltype(new T(std::move(*const_cast< T * >(x))), Constructor
static handle cast(bool src, return_value_policy, handle)
bool load(handle src, bool convert)
PYBIND11_NOINLINE internals & get_internals()
Return a reference to the current internals data.
static handle cast(CharT src, return_value_policy policy, handle parent)
static std::enable_if< std::is_floating_point< U >::value, handle >::type cast(U src, return_value_policy, handle)
type_map< type_info * > registered_types_cpp
object value
The default value.
static handle cast(T, return_value_policy, handle)
bool try_implicit_casts(handle, bool)
detail::type_info * get_local_type_info(const std::type_index &tp)
iterator(instance *inst, const type_vec *tinfo)
std::pair< decltype(internals::registered_types_py)::iterator, bool > all_type_info_get_cache(PyTypeObject *type)
static constexpr size_t size_in_ptrs(size_t s)
Helper class which loads arguments for C++ functions called from Python.
PYBIND11_NOINLINE bool try_load_foreign_module_local(handle src)
void set_instance_registered(bool v=true)
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 y set format x g set format y g set format x2 g set format y2 g set format z g set angles radians set nogrid set key title set key left top Right noreverse box linetype linewidth samplen spacing width set nolabel set noarrow set nologscale set logscale x set set pointsize set encoding default set nopolar set noparametric set set set set surface set nocontour set clabel set mapping cartesian set nohidden3d set cntrparam order set cntrparam linear set cntrparam levels auto set cntrparam points set size set set xzeroaxis lt lw set x2zeroaxis lt lw set yzeroaxis lt lw set y2zeroaxis lt lw set tics in set ticslevel set tics set mxtics default set mytics default set mx2tics default set my2tics default set xtics border mirror norotate autofreq set ytics border mirror norotate autofreq set ztics border nomirror norotate autofreq set nox2tics set noy2tics set timestamp bottom norotate set rrange[*:*] noreverse nowriteback set trange[*:*] noreverse nowriteback set urange[*:*] noreverse nowriteback set vrange[*:*] noreverse nowriteback set xlabel matrix size set x2label set timefmt d m y n H
conditional_t< cast_is_temporary_value_reference< ret_type >::value, make_caster< ret_type >, override_unused > override_caster_t
Type caster for holder types like std::shared_ptr, etc.
typename caster_t::template cast_op_type< type > subcaster_cast_op_type
bool operator!=(const iterator &other) const
bool isinstance(handle obj)
std::unordered_multimap< const void *, instance * > registered_instances
bool load(handle h, bool)
void cast_safe< void >(object &&)
Internal data associated with a single function call.
object call(PyObject *ptr) const
Call a Python function and pass the collected arguments.
static const void * get(const itype *src, const std::type_info *&)
#define PYBIND11_NAMESPACE
bool load(handle src, bool convert)
The 'instance' type which needs to be standard layout (need to be able to use 'offsetof') ...
void check_holder_compat()
std::is_same< intrinsic_t< Arg >, args > argument_is_args
std::tuple< make_caster< Args >... > argcasters
static handle cast(T *src, return_value_policy policy, handle parent)
simple_collector< policy > collect_arguments(Args &&...args)
Collect only positional arguments for a Python function call.
PYBIND11_NOINLINE void clean_type_id(std::string &name)
#define PYBIND11_STRING_NAME
#define PYBIND11_LONG_FROM_UNSIGNED(o)
arg & noconvert(bool flag=true)
Indicate that the type should not be converted in the type caster.
const char * c_str(Args &&...args)
#define PYBIND11_BOOL_ATTR
bool same_type(const std::type_info &lhs, const std::type_info &rhs)
bool_constant< (std::is_reference< type >::value||std::is_pointer< type >::value)&&!std::is_base_of< type_caster_generic, make_caster< type >>::value &&!std::is_same< intrinsic_t< type >, void >::value > cast_is_temporary_value_reference
bool load(handle src, bool)
static handle cast(itype &&src, return_value_policy, handle parent)
PyExc_RuntimeError[[noreturn]] PYBIND11_NOINLINE void pybind11_fail(const char *reason)
Used internally.
type_caster< T, SFINAE > & load_type(type_caster< T, SFINAE > &conv, const handle &handle)
conditional_t< std::is_signed< T >::value, _py_type_0, typename std::make_unsigned< _py_type_0 >::type > _py_type_1
conditional_t< is_copy_constructible< holder_type >::value, copyable_holder_caster< type, holder_type >, move_only_holder_caster< type, holder_type >> type_caster_holder
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
const handle & inc_ref() const &
static handle cast(const std::reference_wrapper< type > &src, return_value_policy policy, handle parent)
constexpr int constexpr_first()
PYBIND11_NOINLINE handle get_object_handle(const void *ptr, const detail::type_info *type)
conditional_t< sizeof(T)<=sizeof(long), long, long long > _py_type_0
PYBIND11_NOINLINE handle get_type_handle(const std::type_info &tp, bool throw_if_missing)
value_and_holder get_value_and_holder(const type_info *find_type=nullptr, bool throw_if_missing=true)
static handle cast(const itype &src, return_value_policy policy, handle parent)
#define PYBIND11_BYTES_CHECK
object operator()(Args &&...args) const
bool try_implicit_casts(handle src, bool convert)
static constexpr uint8_t status_instance_registered
const std::type_info * cpptype
static handle cast(holder_type &&src, return_value_policy, handle)
static std::enable_if<!std::is_floating_point< U >::value &&std::is_signed< U >::value &&(sizeof(U)<=sizeof(long)), handle >::type cast(U src, return_value_policy, handle)
const tuple & args() const &
const function_record & func
The function data:
value_and_holder()=default
arg_v operator=(T &&value) const
Assign a value to this argument.
PyObject * make_new_instance(PyTypeObject *type)
Return call_impl(Func &&f, index_sequence< Is... >, Guard &&)&&
std::vector< bool > args_convert
The convert value the arguments should be loaded with.
void allocate_layout()
Initializes all of the above type/values/holders data (but not the instance values themselves) ...
const std::vector< detail::type_info * > & all_type_info(PyTypeObject *type)
bool convert(const int &y)
const dict & kwargs() const &
simple_collector(Ts &&...values)
bool load(handle src, bool convert)
std::integral_constant< bool, B > bool_constant
Backports of std::bool_constant and std::negation to accommodate older compilers. ...
Eigen::Triplet< double > T
constexpr arg(const char *name=nullptr)
Constructs an argument with the name of the argument; if null or omitted, this is a positional argume...
static void argument_cast_error(std::string name, std::string type)
static std::pair< const void *, const type_info * > src_and_type(const itype *src)
bool operator==(const iterator &other) const
static handle cast(const itype *src, return_value_policy policy, handle parent)
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
static return_value_policy policy(return_value_policy p)
constexpr descr< 0 > concat()
type implicit_cast(index_sequence< Is... >)&
iterator find(const type_info *find_type)
conditional_t< std::is_pointer< typename std::remove_reference< T >::type >::value, typename std::add_pointer< intrinsic_t< T >>::type, conditional_t< std::is_rvalue_reference< T >::value, typename std::add_rvalue_reference< intrinsic_t< T >>::type, typename std::add_lvalue_reference< intrinsic_t< T >>::type >> movable_cast_op_type
type implicit_cast(index_sequence< Is... >)&&
unpacking_collector(Ts &&...values)
Helper type to replace 'void' in some expressions.
~loader_life_support()
... and destroyed after it returns
std::vector< std::pair< const std::type_info *, void *(*)(void *)> > implicit_casts
arg_v(arg &&base, T &&x, const char *descr=nullptr)
value_and_holder(instance *i, const detail::type_info *type, size_t vpos, size_t index)
conditional_t< std::is_floating_point< T >::value, double, _py_type_1 > py_type
#define PYBIND11_BYTES_NAME
constexpr descr< N+2, Ts... > type_descr(const descr< N, Ts... > &descr)
void process(list &args_list, T &&x)
enable_if_t< cast_is_temporary_value_reference< T >::value, T > cast_ref(object &&o, make_caster< T > &caster)
bool load(handle src, bool convert)
bool load(handle src, bool)
arg_v & none(bool flag=true)
Same as arg::nonone(), but returns *this as arg_v&, not arg&.
#define PYBIND11_MODULE_LOCAL_ID
bool owned
If true, the pointer is owned which means we're free to manage it with a holder.
PYBIND11_NOINLINE bool isinstance_generic(handle obj, const std::type_info &tp)
bool load(handle src, bool convert)
arg_v & noconvert(bool flag=true)
Same as arg::noconvert(), but returns *this as arg_v&, not arg&.
static void multiple_values_error()
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const ArgReturnType arg() const
Helper class which collects positional, keyword, * and ** arguments for a Python function call...
loader_life_support()
A new patient frame is created when a function is entered.
type_caster_base(const std::type_info &info)
void check(bool b, bool ref)
bool try_direct_conversions(handle src)
void ** values_and_holders
PYBIND11_NOINLINE void all_type_info_populate(PyTypeObject *t, std::vector< type_info * > &bases)
#define PYBIND11_LONG_AS_LONGLONG(o)
static bool load_impl_sequence(function_call &, index_sequence<>)
std::is_base_of< pyobject_tag, remove_reference_t< T >> is_pyobject
PYBIND11_NOINLINE detail::type_info * get_type_info(PyTypeObject *type)
typename intrinsic_type< T >::type intrinsic_t
std::basic_string< CharT > StringType
static return_value_policy policy(return_value_policy p)
object getattr(handle obj, handle name)
RAII wrapper that temporarily clears any Python error state.
static void nameless_argument_error()
static auto make_copy_constructor(const T *x) -> decltype(new T(*x), Constructor
conditional_t< std::is_pointer< remove_reference_t< T >>::value, typename std::add_pointer< intrinsic_t< T >>::type, typename std::add_lvalue_reference< intrinsic_t< T >>::type > cast_op_type
static handle cast(const holder_type &src, return_value_policy, handle)
void check_holder_compat()
std::is_same< bools< Ts::value..., true >, bools< true, Ts::value... >> all_of
static PYBIND11_NOINLINE handle cast(const void *_src, return_value_policy policy, handle parent, const detail::type_info *tinfo, void *(*copy_constructor)(const void *), void *(*move_constructor)(const void *), const void *existing_holder=nullptr)
bool simple_instance_registered
For simple layout, tracks whether the instance is registered in registered_instances ...
#define PYBIND11_LONG_FROM_SIGNED(o)
std::is_same< intrinsic_t< Arg >, kwargs > argument_is_kwargs
PYBIND11_NOINLINE type_caster_generic(const std::type_info &type_info)
Matrix stack(size_t nrMatrices,...)
handle parent
The parent, if any.
Generic type caster for objects stored on the heap.
value_and_holder & operator*()
enable_if_t<!cast_is_temporary_value_reference< T >::value, T > cast_safe(object &&o)
static handle cast(const StringType &src, return_value_policy, handle)
static handle cast_impl(T &&src, return_value_policy policy, handle parent, index_sequence< Is... >)
static handle cast(const handle &src, return_value_policy, handle)
T cast(const handle &handle)
static handle cast(const CharT *src, return_value_policy policy, handle parent)
arg_v(const arg &base, T &&x, const char *descr=nullptr)
Called internally when invoking py::arg("a") = value
static handle decode_utfN(const char *buffer, ssize_t nbytes)
static PYBIND11_NOINLINE void * local_load(PyObject *src, const type_info *ti)
void * simple_value_holder[1+instance_simple_holder_in_ptrs()]
typename std::enable_if< B, T >::type enable_if_t
from cpp_future import (convenient aliases from C++14/17)
arg_v(const char *name, T &&x, const char *descr=nullptr)
Direct construction with name, default, and description.
bool holder_constructed() const
typename std::basic_string< CharT, Traits, Allocator >::value_type CharT
const char * descr
The (optional) description of the default value.
enable_if_t< std::is_void< Return >::value, void_type > call(Func &&f)&&
T reinterpret_steal(handle h)
Annotation for function names.
void process(list &, detail::kwargs_proxy kp)
Tuple< make_caster< Ts >... > subcasters
const char * name
If non-null, this is a named kwargs argument.
#define PYBIND11_BYTES_AS_STRING
Annotation indicating that a class derives from another given type.
bool load_value(value_and_holder &&v_h)
PYBIND11_NOINLINE std::string error_string()
make_caster< T >::template cast_op_type< T > cast_op(make_caster< T > &caster)
#define PYBIND11_BYTES_SIZE
bool load(handle src, bool convert)
static void multiple_values_error(std::string name)
void load(Archive &ar, Eigen::Matrix< Scalar_, Rows_, Cols_, Ops_, MaxRows_, MaxCols_ > &m, const unsigned int)
handle init_self
If this is a call to an initializer, this argument contains self
PyThreadState * get_thread_state_unchecked()
std::unordered_map< PyTypeObject *, std::vector< type_info * > > registered_types_py
pybind11::detail::cast_op_type< _T > cast_op_type
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
const tuple & args() const &
void *(* module_local_load)(PyObject *, const type_info *)
values_and_holders(instance *inst)
static handle cast(const void *ptr, return_value_policy, handle)
typename make_index_sequence_impl< N >::type make_index_sequence
#define PYBIND11_NOINLINE
Internal data structure which holds metadata about a bound function (signature, overloads, etc.)
return_value_policy
Approach used to cast a previously unknown C++ instance into a Python object.
bool try_implicit_casts(handle src, bool convert)
static PYBIND11_NOINLINE void add_patient(handle h)
static std::enable_if<!std::is_floating_point< U >::value &&std::is_unsigned< U >::value &&(sizeof(U) > sizeof(unsigned long)), handle >::type cast(U src, return_value_policy, handle)
nonsimple_values_and_holders nonsimple
#define PYBIND11_TYPE_CASTER(type, py_name)
PYBIND11_NOINLINE bool load_impl(handle src, bool convert)
static PYBIND11_NOINLINE std::pair< const void *, const type_info * > src_and_type(const void *src, const std::type_info &cast_type, const std::type_info *rtti_type=nullptr)
#define PYBIND11_NAMESPACE_END(name)
std::string type
The C++ type name of the default value (only available when compiled in debug mode) ...
make_index_sequence< sizeof...(Args)> indices
static void argument_cast_error()
#define PYBIND11_NAMESPACE_BEGIN(name)
make_index_sequence< size > indices
value_and_holder * operator->()
static Constructor make_move_constructor(...)
void process(list &args_list, detail::args_proxy ap)
type_caster_generic(const type_info *typeinfo)
bool load(handle src, bool)