63        "base<T>() was deprecated in favor of specifying 'T' as a template argument to class_")
 
   68template <
size_t Nurse, 
size_t Patient>
 
   84    PYBIND11_DEPRECATED(
"py::metaclass() is no longer required. It's turned on by default now.")
 
  102    using callback = std::function<void(PyHeapTypeObject *heap_type)>;
 
  139template <
typename... Ts>
 
  144    using type = detail::void_type;
 
  149    static_assert(std::is_default_constructible<T>::value,
 
  150                  "The guard type must be default constructible");
 
  155template <
typename T, 
typename... Ts>
 
  170template <op_
id id, op_type ot, 
typename L = undefined_t, 
typename R = undefined_t>
 
  204    std::vector<argument_record> 
args;
 
  253    PyMethodDef *
def = 
nullptr;
 
  278    const std::type_info *
type = 
nullptr;
 
  296    void (*
dealloc)(detail::value_and_holder &) = 
nullptr;
 
  302    const char *
doc = 
nullptr;
 
  329        auto *base_info = detail::get_type_info(
base, 
false);
 
  331            std::string tname(
base.name());
 
  332            detail::clean_type_id(tname);
 
  334                          + 
"\" referenced unknown base type \"" + tname + 
"\"");
 
  338            std::string tname(
base.name());
 
  339            detail::clean_type_id(tname);
 
  342                          + 
" a non-default holder type while its base \"" + tname + 
"\" " 
  343                          + (base_info->default_holder ? 
"does not" : 
"does"));
 
  348        if (base_info->type->tp_dictoffset != 0) {
 
  353            base_info->implicit_casts.emplace_back(
type, caster);
 
  372template <
typename T, 
typename SFINAE = 
void>
 
  449        pybind11_fail(
"arg(): cannot specify an unnamed argument after a kw_only() annotation or " 
  456        r->
args.emplace_back(
"self", 
nullptr, 
handle(), 
true, 
false);
 
  476            r->
args.emplace_back(
 
  477                "self", 
nullptr, 
handle(), 
true, 
false);
 
  482            std::string 
descr(
"'");
 
  490                             + (std::string) r->
name + 
"'";
 
  492                    descr += 
" in method of '" + (std::string) 
str(r->
scope) + 
"'";
 
  494            } 
else if (r->
name) {
 
  495                descr += 
" in function '" + (std::string) r->
name + 
"'";
 
  498                          + 
" into a Python object (type not registered yet?)");
 
  501                          "into a Python object (type not registered yet?). " 
  502                          "Compile in debug mode for more information.");
 
  517            pybind11_fail(
"Mismatched args() and kw_only(): they must occur at the same relative " 
  518                          "argument location (or omit kw_only() entirely)");
 
  531            pybind11_fail(
"pos_only(): cannot follow a py::args() argument");
 
  601template <
typename... Ts>
 
  609template <
size_t Nurse, 
size_t Patient>
 
  612    template <
size_t N = Nurse, 
size_t P = Patient, enable_if_t<N != 0 && P != 0, 
int> = 0>
 
  616    template <
size_t N = Nurse, 
size_t P = Patient, enable_if_t<N != 0 && P != 0, 
int> = 0>
 
  618    template <
size_t N = Nurse, 
size_t P = Patient, enable_if_t<N == 0 || P == 0, 
int> = 0>
 
  620    template <
size_t N = Nurse, 
size_t P = Patient, enable_if_t<N == 0 || P == 0, 
int> = 0>
 
  627template <
typename... Args>
 
  632        using expander = 
int[];
 
  639        using expander = 
int[];
 
  645        using expander = 
int[];
 
  652        using expander = 
int[];
 
  662template <
typename... Extra>
 
  666template <
typename... Extra,
 
  667          size_t named = 
constexpr_sum(std::is_base_of<arg, Extra>::value...),
 
  671    return named == 0 || (
self + named + 
size_t(has_args) + 
size_t(has_kwargs)) == nargs;
 
\rst Holds a reference to a Python object (no reference counting)
 
const handle & inc_ref() const &
\rst Manually increase the reference count of the Python object.
 
void append_self_arg_if_needed(function_record *r)
 
void check_kw_only_arg(const arg &a, function_record *r)
 
void keep_alive_impl(size_t Nurse, size_t Patient, function_call &call, handle ret)
 
typename exactly_one_t< is_call_guard, call_guard<>, Extra... >::type extract_guard_t
Extract the type from the first call_guard in Extras... (or void_type if none found)
 
constexpr bool expected_num_args(size_t nargs, bool has_args, bool has_kwargs)
Check the number of named arguments at compile time.
 
typename std::enable_if< B, T >::type enable_if_t
from cpp_future import (convenient aliases from C++14/17)
 
PYBIND11_NOINLINE void pybind11_fail(const char *reason)
Thrown when pybind11::cast or.
 
#define PYBIND11_NOINLINE
 
constexpr size_t constexpr_sum()
Compile-time integer sum.
 
#define PYBIND11_WORKAROUND_INCORRECT_MSVC_C4100(...)
 
#define PYBIND11_NAMESPACE_END(name)
 
typename exactly_one< Predicate, Default, Ts... >::type exactly_one_t
 
#define PYBIND11_NAMESPACE_BEGIN(name)
 
#define PYBIND11_WORKAROUND_INCORRECT_GCC_UNUSED_BUT_SET_PARAMETER(...)
 
return_value_policy
Approach used to cast a previously unknown C++ instance into a Python object.
 
@ move
Use std::move to move the return value contents into a new instance that will be owned by Python.
 
#define PYBIND11_DEPRECATED(reason)
 
op_id
Enumeration with all supported operator types.
 
detail::initimpl::constructor< Args... > init()
Binds an existing constructor taking arguments Args...
 
std::is_base_of< pyobject_tag, remove_reference_t< T > > is_pyobject
 
Annotation for arguments with values.
 
object value
The default value.
 
std::string type
The C++ type name of the default value (only available when compiled in debug mode)
 
const char * descr
The (optional) description of the default value.
 
Annotation for arguments.
 
const char * name
If non-null, this is a named kwargs argument.
 
bool flag_none
If set (the default), allow None to be passed to this argument.
 
bool flag_noconvert
If set, do not allow conversion (requires a supporting type caster!)
 
Internal data structure which holds metadata about a keyword argument.
 
argument_record(const char *name, const char *descr, handle value, bool convert, bool none)
 
handle value
Associated Python object.
 
const char * name
Argument name.
 
bool none
True if None is allowed when loading.
 
bool convert
True if the argument is allowed to convert when loading.
 
const char * descr
Human-readable version of the argument value.
 
Annotation to mark enums as an arithmetic type.
 
Annotation indicating that a class derives from another given type.
 
PYBIND11_DEPRECATED("base<T>() was deprecated in favor of specifying 'T' as a template argument to class_") base()
 
Annotation which enables the buffer protocol for a type.
 
\rst A call policy which places one or more guard variables (Ts...) around the function call.
 
Specifies a custom callback with signature void (PyHeapTypeObject*) that may be used to customize the...
 
std::function< void(PyHeapTypeObject *heap_type)> callback
 
custom_type_setup(callback value)
 
Annotation for documentation.
 
Annotation which enables dynamic attributes, i.e. adds __dict__ to a class.
 
Internal data associated with a single function call.
 
function_call(const function_record &f, handle p)
 
std::vector< bool > args_convert
The convert value the arguments should be loaded with.
 
Internal data structure which holds metadata about a bound function (signature, overloads,...
 
bool prepend
True if this function is to be inserted at the beginning of the overload resolution chain.
 
void(* free_data)(function_record *ptr)
Pointer to custom destructor for 'data' (if needed)
 
return_value_policy policy
Return value policy associated with this function.
 
bool is_new_style_constructor
True if this is a new-style __init__ defined in detail/init.h
 
std::uint16_t nargs_pos_only
Number of leading arguments (counted in nargs) that are positional-only.
 
function_record * next
Pointer to next overload.
 
handle(* impl)(function_call &)
Pointer to lambda function which converts arguments and performs the actual call.
 
handle sibling
Python handle to the sibling function representing an overload chain.
 
std::uint16_t nargs
Number of arguments (including py::args and/or py::kwargs, if present)
 
std::uint16_t nargs_pos
Number of leading positional arguments, which are terminated by a py::args or py::kwargs argument or ...
 
char * signature
Human-readable version of the function signature.
 
bool is_constructor
True if name == 'init'.
 
bool is_method
True if this is a method.
 
bool is_operator
True if this is an operator (add), etc.
 
bool is_stateless
True if this is a stateless function pointer.
 
std::vector< argument_record > args
List of registered keyword arguments.
 
char * name
Function name.
 
handle scope
Python handle to the parent scope (a class or a module)
 
PyMethodDef * def
Python method object.
 
void * data[3]
Storage for the wrapped function pointer and captured data, if any.
 
bool has_args
True if the function has a '*args' argument.
 
bool has_kwargs
True if the function has a '**kwargs' argument.
 
The 'instance' type which needs to be standard layout (need to be able to use 'offsetof')
 
Annotation for classes that cannot be subclassed.
 
Check if T is an instantiation of the template Class.
 
is_method(const handle &c)
 
Tag for a new-style __init__ defined in detail/init.h
 
Annotation for operators.
 
Keep patient alive while nurse lives.
 
Annotation indicating that all following arguments are keyword-only; the is the equivalent of an unna...
 
Annotation that marks a class as local to the module:
 
constexpr module_local(bool v=true)
 
Annotation indicating that a class is involved in a multiple inheritance relationship.
 
Annotation for function names.
 
Operator implementation generator.
 
Annotation indicating that all previous arguments are positional-only; the is the equivalent of an un...
 
Mark a function for addition at the beginning of the existing overload chain instead of the end.
 
static void init(const handle &h, type_record *r)
 
static void init(const arg &a, function_record *r)
 
static void init(const arg_v &a, function_record *r)
 
static void init(const base< T > &, type_record *r)
 
static void init(const buffer_protocol &, type_record *r)
 
static void init(const char *d, type_record *r)
 
static void init(const char *d, function_record *r)
 
static void init(const custom_type_setup &value, type_record *r)
 
static void init(const doc &n, function_record *r)
 
static void init(const dynamic_attr &, type_record *r)
 
static void init(const is_final &, type_record *r)
 
static void init(const is_method &s, function_record *r)
 
static void init(const is_new_style_constructor &, function_record *r)
 
static void init(const is_operator &, function_record *r)
 
static void precall(function_call &call)
 
static void postcall(function_call &call, handle ret)
 
static void postcall(function_call &, handle)
 
static void precall(function_call &)
 
static void init(const kw_only &, function_record *r)
 
static void init(const module_local &l, type_record *r)
 
static void init(const multiple_inheritance &, type_record *r)
 
static void init(const name &n, function_record *r)
 
static void init(const pos_only &, function_record *r)
 
static void init(const prepend &, function_record *r)
 
static void init(const return_value_policy &p, function_record *r)
 
static void init(const scope &s, function_record *r)
 
static void init(const sibling &s, function_record *r)
 
static void init(const T &, function_record *)
Default implementation: do nothing.
 
static void postcall(function_call &, handle)
 
static void precall(function_call &)
 
static void init(const T &, type_record *)
 
Partial template specializations to process custom attributes provided to cpp_function_ and class_.
 
Recursively iterate over variadic template arguments.
 
static void precall(function_call &call)
 
static void init(const Args &...args, function_record *r)
 
static void init(const Args &...args, type_record *r)
 
static void postcall(function_call &call, handle fn_ret)
 
Annotation for parent scope.
 
Annotation indicating that a function is an overload associated with a given "sibling".
 
sibling(const handle &value)
 
Special data structure which (temporarily) holds metadata about a bound class.
 
handle metaclass
Custom metaclass (optional)
 
bool multiple_inheritance
Multiple inheritance marker.
 
bool default_holder
Is the default (unique_ptr) holder type used?
 
PYBIND11_NOINLINE type_record()
 
size_t holder_size
How large is the type's holder?
 
bool module_local
Is the class definition local to the module shared object?
 
void(* init_instance)(instance *, const void *)
Function pointer to class_<..>::init_instance.
 
bool is_final
Is the class inheritable from python classes?
 
size_t type_size
How large is the underlying C++ type?
 
handle scope
Handle to the parent scope.
 
bool buffer_protocol
Does the class implement the buffer protocol?
 
const char * doc
Optional docstring.
 
size_t type_align
What is the alignment of the underlying C++ type?
 
PYBIND11_NOINLINE void add_base(const std::type_info &base, void *(*caster)(void *))
 
list bases
List of base classes of the newly created type.
 
custom_type_setup::callback custom_type_setup_callback
Custom type setup.
 
bool dynamic_attr
Does the class manage a dict?
 
void(* dealloc)(detail::value_and_holder &)
Function pointer to class_<..>::dealloc.
 
Type for an unused type slot.