mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 05:05:11 +00:00
documentation updates (clarified cross-module dependencies, added contributors, improved CSS)
This commit is contained in:
parent
bce8a4b95c
commit
8d862b37b4
@ -4,7 +4,7 @@
|
||||
|
||||
[![Documentation Status](https://readthedocs.org/projects/pybind11/badge/?version=latest)](http://pybind11.readthedocs.org/en/latest/?badge=latest)
|
||||
[![Build Status](https://travis-ci.org/pybind/pybind11.svg?branch=master)](https://travis-ci.org/pybind/pybind11)
|
||||
[![Build status](https://ci.appveyor.com/api/projects/status/riaj54pn4h08xy40?svg=true)](https://ci.appveyor.com/project/pybind/pybind11)
|
||||
[![Build status](https://ci.appveyor.com/api/projects/status/riaj54pn4h08xy40?svg=true)](https://ci.appveyor.com/project/wjakob/pybind11)
|
||||
|
||||
**pybind11** is a lightweight header-only library that exposes C++ types in Python
|
||||
and vice versa, mainly to create Python bindings of existing C++ code. Its
|
||||
@ -92,8 +92,9 @@ Significant features and/or improvements to the code were contributed by
|
||||
Jonas Adler,
|
||||
Sylvain Corlay,
|
||||
Axel Huebl,
|
||||
Johan Mabille, and
|
||||
Tomasz Miąsko.
|
||||
Johan Mabille,
|
||||
Tomasz Miąsko, and
|
||||
Ben Pritchard.
|
||||
|
||||
### License
|
||||
|
||||
|
4
docs/_static/theme_overrides.css
vendored
4
docs/_static/theme_overrides.css
vendored
@ -1,7 +1,7 @@
|
||||
.wy-table-responsive table td,
|
||||
.wy-table-responsive table th {
|
||||
white-space: initial;
|
||||
white-space: initial !important;
|
||||
}
|
||||
.rst-content table.docutils td {
|
||||
vertical-align: top;
|
||||
vertical-align: top !important;
|
||||
}
|
||||
|
@ -1019,8 +1019,8 @@ like so:
|
||||
Partitioning code over multiple extension modules
|
||||
=================================================
|
||||
|
||||
It's straightforward to split binding code over multiple extension modules and
|
||||
reference types declared elsewhere. Everything "just" works without any special
|
||||
It's straightforward to split binding code over multiple extension modules, while
|
||||
referencing types that are declared elsewhere. Everything "just" works without any special
|
||||
precautions. One exception to this rule occurs when wanting to extend a type declared
|
||||
in another extension module. Recall the basic example from Section
|
||||
:ref:`inheritance`.
|
||||
@ -1049,3 +1049,17 @@ However, it can be acquired as follows:
|
||||
.def(py::init<const std::string &>())
|
||||
.def("bark", &Dog::bark);
|
||||
|
||||
Alternatively, we can rely on the ``base`` tag, which performs an automated
|
||||
lookup of the corresponding Python type. However, this also requires invoking
|
||||
the ``import`` function once to ensure that the pybind11 binding code of the
|
||||
module ``basic`` has been executed.
|
||||
|
||||
Naturally, both methods will fail when there are cyclic dependencies.
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
py::module::import("basic");
|
||||
|
||||
py::class_<Dog>(m, "Dog", py::base<Pet>())
|
||||
.def(py::init<const std::string &>())
|
||||
.def("bark", &Dog::bark);
|
||||
|
Loading…
Reference in New Issue
Block a user