12 #define PYBIND11_VERSION_MAJOR 2
13 #define PYBIND11_VERSION_MINOR 6
14 #define PYBIND11_VERSION_PATCH 0
16 #define PYBIND11_NAMESPACE_BEGIN(name) namespace name {
17 #define PYBIND11_NAMESPACE_END(name) }
22 #if !defined(PYBIND11_NAMESPACE)
24 # define PYBIND11_NAMESPACE pybind11 __attribute__((visibility("hidden")))
26 # define PYBIND11_NAMESPACE pybind11
30 #if !(defined(_MSC_VER) && __cplusplus == 199711L) && !defined(__INTEL_COMPILER)
31 # if __cplusplus >= 201402L
32 # define PYBIND11_CPP14
33 # if __cplusplus >= 201703L
34 # define PYBIND11_CPP17
37 #elif defined(_MSC_VER) && __cplusplus == 199711L
40 # if _MSVC_LANG >= 201402L
41 # define PYBIND11_CPP14
42 # if _MSVC_LANG > 201402L && _MSC_VER >= 1910
43 # define PYBIND11_CPP17
49 #if defined(__INTEL_COMPILER)
50 # if __INTEL_COMPILER < 1800
51 # error pybind11 requires Intel C++ compiler v18 or newer
53 #elif defined(__clang__) && !defined(__apple_build_version__)
54 # if __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 3)
55 # error pybind11 requires clang 3.3 or newer
57 #elif defined(__clang__)
60 # if __clang_major__ < 5
61 # error pybind11 requires Xcode/clang 5.0 or newer
63 #elif defined(__GNUG__)
64 # if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8)
65 # error pybind11 requires gcc 4.8 or newer
67 #elif defined(_MSC_VER)
70 # if _MSC_FULL_VER < 190024210
71 # error pybind11 requires MSVC 2015 update 3 or newer
75 #if !defined(PYBIND11_EXPORT)
76 # if defined(WIN32) || defined(_WIN32)
77 # define PYBIND11_EXPORT __declspec(dllexport)
79 # define PYBIND11_EXPORT __attribute__ ((visibility("default")))
84 # define PYBIND11_NOINLINE __declspec(noinline)
86 # define PYBIND11_NOINLINE __attribute__ ((noinline))
89 #if defined(PYBIND11_CPP14)
90 # define PYBIND11_DEPRECATED(reason) [[deprecated(reason)]]
92 # define PYBIND11_DEPRECATED(reason) __attribute__((deprecated(reason)))
95 #if defined(PYBIND11_CPP17)
96 # define PYBIND11_MAYBE_UNUSED [[maybe_unused]]
97 #elif defined(_MSC_VER) && !defined(__clang__)
98 # define PYBIND11_MAYBE_UNUSED
100 # define PYBIND11_MAYBE_UNUSED __attribute__ ((__unused__))
105 #if defined(_MSC_VER) && _MSC_VER >= 1900
106 # define HAVE_SNPRINTF 1
110 #if defined(_MSC_VER)
111 # if (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION < 4)
112 # define HAVE_ROUND 1
114 # pragma warning(push)
115 # pragma warning(disable: 4510 4610 4512 4005)
116 # if defined(_DEBUG) && !defined(Py_DEBUG)
117 # define PYBIND11_DEBUG_MARKER
123 #include <frameobject.h>
124 #include <pythread.h>
139 #if defined(copysign)
143 #if defined(_MSC_VER)
144 # if defined(PYBIND11_DEBUG_MARKER)
146 # undef PYBIND11_DEBUG_MARKER
148 # pragma warning(pop)
153 #include <forward_list>
158 #include <unordered_set>
159 #include <unordered_map>
162 #include <type_traits>
164 #if PY_MAJOR_VERSION >= 3
165 #define PYBIND11_INSTANCE_METHOD_NEW(ptr, class_) PyInstanceMethod_New(ptr)
166 #define PYBIND11_INSTANCE_METHOD_CHECK PyInstanceMethod_Check
167 #define PYBIND11_INSTANCE_METHOD_GET_FUNCTION PyInstanceMethod_GET_FUNCTION
168 #define PYBIND11_BYTES_CHECK PyBytes_Check
169 #define PYBIND11_BYTES_FROM_STRING PyBytes_FromString
170 #define PYBIND11_BYTES_FROM_STRING_AND_SIZE PyBytes_FromStringAndSize
171 #define PYBIND11_BYTES_AS_STRING_AND_SIZE PyBytes_AsStringAndSize
172 #define PYBIND11_BYTES_AS_STRING PyBytes_AsString
173 #define PYBIND11_BYTES_SIZE PyBytes_Size
174 #define PYBIND11_LONG_CHECK(o) PyLong_Check(o)
175 #define PYBIND11_LONG_AS_LONGLONG(o) PyLong_AsLongLong(o)
176 #define PYBIND11_LONG_FROM_SIGNED(o) PyLong_FromSsize_t((ssize_t) o)
177 #define PYBIND11_LONG_FROM_UNSIGNED(o) PyLong_FromSize_t((size_t) o)
178 #define PYBIND11_BYTES_NAME "bytes"
179 #define PYBIND11_STRING_NAME "str"
180 #define PYBIND11_SLICE_OBJECT PyObject
181 #define PYBIND11_FROM_STRING PyUnicode_FromString
182 #define PYBIND11_STR_TYPE ::pybind11::str
183 #define PYBIND11_BOOL_ATTR "__bool__"
184 #define PYBIND11_NB_BOOL(ptr) ((ptr)->nb_bool)
185 #define PYBIND11_BUILTINS_MODULE "builtins"
188 #define PYBIND11_PLUGIN_IMPL(name) \
189 extern "C" PYBIND11_MAYBE_UNUSED PYBIND11_EXPORT PyObject *PyInit_##name(); \
190 extern "C" PYBIND11_EXPORT PyObject *PyInit_##name()
193 #define PYBIND11_INSTANCE_METHOD_NEW(ptr, class_) PyMethod_New(ptr, nullptr, class_)
194 #define PYBIND11_INSTANCE_METHOD_CHECK PyMethod_Check
195 #define PYBIND11_INSTANCE_METHOD_GET_FUNCTION PyMethod_GET_FUNCTION
196 #define PYBIND11_BYTES_CHECK PyString_Check
197 #define PYBIND11_BYTES_FROM_STRING PyString_FromString
198 #define PYBIND11_BYTES_FROM_STRING_AND_SIZE PyString_FromStringAndSize
199 #define PYBIND11_BYTES_AS_STRING_AND_SIZE PyString_AsStringAndSize
200 #define PYBIND11_BYTES_AS_STRING PyString_AsString
201 #define PYBIND11_BYTES_SIZE PyString_Size
202 #define PYBIND11_LONG_CHECK(o) (PyInt_Check(o) || PyLong_Check(o))
203 #define PYBIND11_LONG_AS_LONGLONG(o) (PyInt_Check(o) ? (long long) PyLong_AsLong(o) : PyLong_AsLongLong(o))
204 #define PYBIND11_LONG_FROM_SIGNED(o) PyInt_FromSsize_t((ssize_t) o)
205 #define PYBIND11_LONG_FROM_UNSIGNED(o) PyInt_FromSize_t((size_t) o)
206 #define PYBIND11_BYTES_NAME "str"
207 #define PYBIND11_STRING_NAME "unicode"
208 #define PYBIND11_SLICE_OBJECT PySliceObject
209 #define PYBIND11_FROM_STRING PyString_FromString
210 #define PYBIND11_STR_TYPE ::pybind11::bytes
211 #define PYBIND11_BOOL_ATTR "__nonzero__"
212 #define PYBIND11_NB_BOOL(ptr) ((ptr)->nb_nonzero)
213 #define PYBIND11_BUILTINS_MODULE "__builtin__"
216 #define PYBIND11_PLUGIN_IMPL(name) \
217 static PyObject *pybind11_init_wrapper(); \
218 extern "C" PYBIND11_MAYBE_UNUSED PYBIND11_EXPORT void init##name(); \
219 extern "C" PYBIND11_EXPORT void init##name() { \
220 (void)pybind11_init_wrapper(); \
222 PyObject *pybind11_init_wrapper()
225 #if PY_VERSION_HEX >= 0x03050000 && PY_VERSION_HEX < 0x03050200
227 struct _Py_atomic_address {
void *value; };
228 PyAPI_DATA(_Py_atomic_address) _PyThreadState_Current;
232 #define PYBIND11_TRY_NEXT_OVERLOAD ((PyObject *) 1)
233 #define PYBIND11_STRINGIFY(x) #x
234 #define PYBIND11_TOSTRING(x) PYBIND11_STRINGIFY(x)
235 #define PYBIND11_CONCAT(first, second) first##second
236 #define PYBIND11_ENSURE_INTERNALS_READY \
237 pybind11::detail::get_internals();
239 #define PYBIND11_CHECK_PYTHON_VERSION \
241 const char *compiled_ver = PYBIND11_TOSTRING(PY_MAJOR_VERSION) \
242 "." PYBIND11_TOSTRING(PY_MINOR_VERSION); \
243 const char *runtime_ver = Py_GetVersion(); \
244 size_t len = std::strlen(compiled_ver); \
245 if (std::strncmp(runtime_ver, compiled_ver, len) != 0 \
246 || (runtime_ver[len] >= '0' && runtime_ver[len] <= '9')) { \
247 PyErr_Format(PyExc_ImportError, \
248 "Python version mismatch: module was compiled for Python %s, " \
249 "but the interpreter version is incompatible: %s.", \
250 compiled_ver, runtime_ver); \
255 #define PYBIND11_CATCH_INIT_EXCEPTIONS \
256 catch (pybind11::error_already_set &e) { \
257 PyErr_SetString(PyExc_ImportError, e.what()); \
259 } catch (const std::exception &e) { \
260 PyErr_SetString(PyExc_ImportError, e.what()); \
279 #define PYBIND11_PLUGIN(name) \
280 PYBIND11_DEPRECATED("PYBIND11_PLUGIN is deprecated, use PYBIND11_MODULE") \
281 static PyObject *pybind11_init(); \
282 PYBIND11_PLUGIN_IMPL(name) { \
283 PYBIND11_CHECK_PYTHON_VERSION \
284 PYBIND11_ENSURE_INTERNALS_READY \
286 return pybind11_init(); \
287 } PYBIND11_CATCH_INIT_EXCEPTIONS \
289 PyObject *pybind11_init()
312 #define PYBIND11_MODULE(name, variable) \
313 static ::pybind11::module_::module_def \
314 PYBIND11_CONCAT(pybind11_module_def_, name); \
315 PYBIND11_MAYBE_UNUSED \
316 static void PYBIND11_CONCAT(pybind11_init_, name)(::pybind11::module_ &); \
317 PYBIND11_PLUGIN_IMPL(name) { \
318 PYBIND11_CHECK_PYTHON_VERSION \
319 PYBIND11_ENSURE_INTERNALS_READY \
320 auto m = ::pybind11::module_::create_extension_module( \
321 PYBIND11_TOSTRING(name), nullptr, \
322 &PYBIND11_CONCAT(pybind11_module_def_, name)); \
324 PYBIND11_CONCAT(pybind11_init_, name)(m); \
326 } PYBIND11_CATCH_INIT_EXCEPTIONS \
328 void PYBIND11_CONCAT(pybind11_init_, name)(::pybind11::module_ &variable)
331 PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
333 using ssize_t = Py_ssize_t;
334 using size_t = std::size_t;
337 enum class return_value_policy : uint8_t {
388 PYBIND11_NAMESPACE_BEGIN(detail)
390 inline static constexpr
int log2(
size_t n,
int k = 0) {
return (n <= 1) ? k : log2(n >> 1, k + 1); }
393 inline static constexpr
size_t size_in_ptrs(
size_t s) {
return 1 + ((s - 1) >> log2(
sizeof(
void *))); }
401 constexpr
size_t instance_simple_holder_in_ptrs() {
402 static_assert(
sizeof(std::shared_ptr<int>) >=
sizeof(std::unique_ptr<int>),
403 "pybind assumes std::shared_ptrs are at least as big as std::unique_ptrs");
404 return size_in_ptrs(
sizeof(std::shared_ptr<int>));
421 void *simple_value_holder[1 + instance_simple_holder_in_ptrs()];
472 static constexpr uint8_t status_instance_registered = 2;
475 static_assert(std::is_standard_layout<instance>::value,
"Internal error: `pybind11::detail::instance` is not standard layout!");
478 #if defined(PYBIND11_CPP14) && (!defined(_MSC_VER) || _MSC_VER >= 1910)
479 using std::enable_if_t;
480 using std::conditional_t;
481 using std::remove_cv_t;
482 using std::remove_reference_t;
484 template <
bool B,
typename T =
void>
using enable_if_t =
typename std::enable_if<B, T>::type;
485 template <
bool B,
typename T,
typename F>
using conditional_t =
typename std::conditional<B, T, F>::type;
486 template <
typename T>
using remove_cv_t =
typename std::remove_cv<T>::type;
487 template <
typename T>
using remove_reference_t =
typename std::remove_reference<T>::type;
491 #if defined(PYBIND11_CPP14)
492 using std::index_sequence;
493 using std::make_index_sequence;
504 :
select_indices_impl<conditional_t<B, index_sequence<IPrev..., I>, index_sequence<IPrev...>>, I + 1, Bs...> {};
508 template <
bool B>
using bool_constant = std::integral_constant<bool, B>;
509 template <
typename T>
struct negation : bool_constant<!T::value> { };
514 #if defined(__PGIC__) || defined(__INTEL_COMPILER)
515 template<
typename... >
using void_t = void;
523 #if defined(__cpp_fold_expressions) && !(defined(_MSC_VER) && (_MSC_VER < 1916))
524 template <
class... Ts>
using all_of = bool_constant<(Ts::value && ...)>;
525 template <
class... Ts>
using any_of = bool_constant<(Ts::value || ...)>;
526 #elif !defined(_MSC_VER)
528 template <
class... Ts>
using all_of = std::is_same<
529 bools<Ts::value...,
true>,
530 bools<
true, Ts::value...>>;
535 template <
class... Ts>
using all_of = std::conjunction<Ts...>;
536 template <
class... Ts>
using any_of = std::disjunction<Ts...>;
540 template <
class T,
template<
class>
class... Predicates>
using satisfies_all_of = all_of<Predicates<T>...>;
546 template <
typename C,
typename R,
typename... A>
struct remove_class<R (C::*)(A...)> {
using type = R (A...); };
547 template <
typename C,
typename R,
typename... A>
struct remove_class<R (C::*)(A...) const> {
using type = R (A...); };
551 template <
typename T>
struct intrinsic_type<const T> {
using type =
typename intrinsic_type<T>::type; };
555 template <
typename T,
size_t N>
struct intrinsic_type<const T[N]> {
using type =
typename intrinsic_type<T>::type; };
556 template <
typename T,
size_t N>
struct intrinsic_type<T[N]> {
using type =
typename intrinsic_type<T>::type; };
557 template <
typename T>
using intrinsic_t =
typename intrinsic_type<T>::type;
566 #ifdef __cpp_fold_expressions
567 template <
typename... Ts> constexpr
size_t constexpr_sum(Ts... ns) {
return (0 + ... +
size_t{ns}); }
569 constexpr
size_t constexpr_sum() {
return 0; }
570 template <
typename T,
typename... Ts>
571 constexpr
size_t constexpr_sum(T n, Ts... ns) {
return size_t{n} + constexpr_sum(ns...); }
574 PYBIND11_NAMESPACE_BEGIN(constexpr_impl)
576 constexpr
int first(
int i) {
return i; }
577 template <
typename T,
typename... Ts>
578 constexpr
int first(
int i, T v, Ts... vs) {
return v ? i : first(i + 1, vs...); }
580 constexpr
int last(
int ,
int result) {
return result; }
581 template <
typename T,
typename... Ts>
582 constexpr
int last(
int i,
int result, T v, Ts... vs) {
return last(i + 1, v ? i : result, vs...); }
583 PYBIND11_NAMESPACE_END(constexpr_impl)
587 template <
template<
typename>
class Predicate,
typename... Ts>
588 constexpr
int constexpr_first() {
return constexpr_impl::first(0, Predicate<Ts>::value...); }
591 template <
template<
typename>
class Predicate,
typename... Ts>
592 constexpr
int constexpr_last() {
return constexpr_impl::last(0, -1, Predicate<Ts>::value...); }
595 template <
size_t N,
typename T,
typename... Ts>
597 template <
typename T,
typename... Ts>
602 template <
template<
typename>
class Predicate,
typename Default,
typename... Ts>
604 static constexpr
auto found = constexpr_sum(Predicate<Ts>::value...);
605 static_assert(found <= 1,
"Found more than one type matching the predicate");
607 static constexpr
auto index = found ? constexpr_first<Predicate, Ts...>() : 0;
608 using type = conditional_t<found,
typename pack_element<index, Ts...>::type, Default>;
610 template <
template<
typename>
class P,
typename Default>
613 template <
template<
typename>
class Predicate,
typename Default,
typename... Ts>
618 template <
typename T,
typename... Us>
using deferred_t =
typename deferred_type<T, Us...>
::type;
622 template <
typename Base,
typename Derived>
using is_strict_base_of = bool_constant<
623 std::is_base_of<Base, Derived>::value && !std::is_same<Base, Derived>::value>;
628 template <
typename Base,
typename Derived>
using is_accessible_base_of = bool_constant<
629 (std::is_same<Base, Derived>::value || std::is_base_of<Base, Derived>::value) && std::is_convertible<Derived *, Base *>::value>;
631 template <
template<
typename...>
class Base>
633 template <
typename... Us>
static std::true_type check(Base<Us...> *);
634 static std::false_type check(...);
639 template <
template<
typename...>
class Base,
typename T>
640 #if !defined(_MSC_VER)
643 struct is_template_base_of : decltype(is_template_base_of_impl<Base>::check((intrinsic_t<T>*)nullptr)) { };
648 template <
template<
typename...>
class Class,
typename T>
650 template <
template<
typename...>
class Class,
typename... Us>
658 template <
typename T>
659 struct is_input_iterator<T, void_t<decltype(*std::declval<T &>()), decltype(++std::declval<T &>())>>
662 template <
typename T>
using is_function_pointer = bool_constant<
663 std::is_pointer<T>::value && std::is_function<typename std::remove_pointer<T>::type>::value>;
670 template <
typename Function,
typename F = remove_reference_t<Function>>
671 using function_signature_t = conditional_t<
672 std::is_function<F>::value,
674 typename conditional_t<
675 std::is_pointer<F>::value || std::is_member_pointer<F>::value,
676 std::remove_pointer<F>,
685 std::is_function, std::is_pointer, std::is_member_pointer>;
688 inline void ignore_unused(
const int *) { }
691 #ifdef __cpp_fold_expressions
692 #define PYBIND11_EXPAND_SIDE_EFFECTS(PATTERN) (((PATTERN), void()), ...)
694 using expand_side_effects =
bool[];
695 #define PYBIND11_EXPAND_SIDE_EFFECTS(PATTERN) (void)pybind11::detail::expand_side_effects{ ((PATTERN), void(), false)..., false }
698 PYBIND11_NAMESPACE_END(detail)
703 using std::runtime_error::runtime_error;
708 #define PYBIND11_RUNTIME_EXCEPTION(name, type) \
709 class name : public builtin_exception { public: \
710 using builtin_exception::builtin_exception; \
711 name() : name("") { } \
712 void set_error() const override { PyErr_SetString(type, what()); } \
715 PYBIND11_RUNTIME_EXCEPTION(stop_iteration, PyExc_StopIteration)
716 PYBIND11_RUNTIME_EXCEPTION(index_error, PyExc_IndexError)
717 PYBIND11_RUNTIME_EXCEPTION(key_error, PyExc_KeyError)
718 PYBIND11_RUNTIME_EXCEPTION(value_error, PyExc_ValueError)
719 PYBIND11_RUNTIME_EXCEPTION(type_error, PyExc_TypeError)
720 PYBIND11_RUNTIME_EXCEPTION(buffer_error, PyExc_BufferError)
721 PYBIND11_RUNTIME_EXCEPTION(import_error, PyExc_ImportError)
722 PYBIND11_RUNTIME_EXCEPTION(cast_error, PyExc_RuntimeError)
723 PYBIND11_RUNTIME_EXCEPTION(reference_cast_error, PyExc_RuntimeError)
725 [[noreturn]] PYBIND11_NOINLINE
inline void pybind11_fail(
const char *reason) {
throw std::runtime_error(reason); }
726 [[noreturn]] PYBIND11_NOINLINE
inline void pybind11_fail(
const std::string &reason) {
throw std::runtime_error(reason); }
730 PYBIND11_NAMESPACE_BEGIN(detail)
736 template <typename T, typename SFINAE =
void> struct
is_fmt_numeric {
static constexpr
bool value =
false; };
737 template <
typename T>
struct is_fmt_numeric<T, enable_if_t<std::is_arithmetic<T>::value>> {
738 static constexpr
bool value =
true;
739 static constexpr
int index = std::is_same<T, bool>::value ? 0 : 1 + (
740 std::is_integral<T>::value ? detail::log2(
sizeof(T))*2 + std::is_unsigned<T>::value : 8 + (
741 std::is_same<T, double>::value ? 1 : std::is_same<T, long double>::value ? 2 : 0));
743 PYBIND11_NAMESPACE_END(detail)
745 template <typename T> struct
format_descriptor<T, detail::enable_if_t<std::is_arithmetic<T>::value>> {
746 static constexpr
const char c =
"?bBhHiIqQfdg"[detail::is_fmt_numeric<T>::index];
747 static constexpr
const char value[2] = { c,
'\0' };
748 static std::string format() {
return std::string(1, c); }
751 #if !defined(PYBIND11_CPP17)
754 T, detail::enable_if_t<std::is_arithmetic<T>::value>>::value[2];
760 PyObject *
type, *value, *trace;
766 struct nodelete {
template <
typename T>
void operator()(T*) { } };
768 PYBIND11_NAMESPACE_BEGIN(detail)
769 template <
typename... Args>
773 template <
typename Return>
774 constexpr
auto operator()(Return (*pf)(Args...))
const noexcept
775 -> decltype(pf) {
return pf; }
777 template <
typename Return,
typename Class>
778 constexpr
auto operator()(Return (Class::*pmf)(Args...), std::false_type = {})
const noexcept
779 -> decltype(pmf) {
return pmf; }
781 template <
typename Return,
typename Class>
782 constexpr
auto operator()(Return (Class::*pmf)(Args...)
const, std::true_type)
const noexcept
783 -> decltype(pmf) {
return pmf; }
785 PYBIND11_NAMESPACE_END(detail)
788 #if defined(PYBIND11_CPP14)
789 #define PYBIND11_OVERLOAD_CAST 1
793 template <
typename... Args>
794 static constexpr detail::overload_cast_impl<Args...>
overload_cast = {};
801 static constexpr
auto const_ = std::true_type{};
803 #if !defined(PYBIND11_CPP14)
805 static_assert(detail::deferred_t<std::false_type, Args...>::value,
806 "pybind11::overload_cast<...> requires compiling in C++14 mode");
810 PYBIND11_NAMESPACE_BEGIN(detail)
815 template <
typename T>
822 template <typename It, typename = enable_if_t<is_input_iterator<It>::value>>
826 template <typename Container, typename = enable_if_t<std::is_convertible<decltype(*std::begin(std::declval<const Container &>())), T>::value>>
831 template <typename TIn, typename = enable_if_t<std::is_convertible<TIn, T>::value>>
838 operator std::vector<T> &&() && {
return std::move(v); }
841 std::vector<T> &operator*() {
return v; }
842 const std::vector<T> &operator*()
const {
return v; }
845 std::vector<T> *operator->() {
return &v; }
846 const std::vector<T> *operator->()
const {
return &v; }
850 std::string get_fully_qualified_tp_name(PyTypeObject*);
852 PYBIND11_NAMESPACE_END(detail)
853 PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE)
C++ bindings of builtin Python exceptions.
virtual void set_error() const =0
Set the error using the Python C API.
Compile-time all/any/none of that check the boolean value of all template types.
Defer the evaluation of type T until types Us are instantiated.
RAII wrapper that temporarily clears any Python error state.
The 'instance' type which needs to be standard layout (need to be able to use 'offsetof')
bool simple_instance_registered
For simple layout, tracks whether the instance is registered in registered_instances
value_and_holder get_value_and_holder(const type_info *find_type=nullptr, bool throw_if_missing=true)
static constexpr uint8_t status_holder_constructed
Bit values for the non-simple status flags.
bool simple_holder_constructed
For simple layout, tracks whether the holder has been constructed.
void allocate_layout()
Initializes all of the above type/values/holders data (but not the instance values themselves)
void deallocate_layout()
Destroys/deallocates all of the above.
bool owned
If true, the pointer is owned which means we're free to manage it with a holder.
bool has_patients
If true, get_internals().patients has an entry for this object.
PyObject * weakrefs
Weak references.
Helper template to strip away type modifiers.
Dummy destructor wrapper that can be used to expose classes with a private destructor.
Return the Nth element from the parameter pack.
Strip the class from a method type.
Make an index sequence of the indices of true arguments.
Helper template which holds a list of types.
Helper type to replace 'void' in some expressions.