Updated advanced.rst example references

This commit is contained in:
Jason Rhinelander 2016-07-18 17:03:37 -04:00
parent b3f3d79f4c
commit 3e2e44f53f

View File

@ -102,8 +102,9 @@ C++ side, or to perform other types of customization.
.. seealso:: .. seealso::
The file :file:`example/example3.cpp` contains a complete example that The file :file:`example/example-operator-overloading.cpp` contains a
demonstrates how to work with overloaded operators in more detail. complete example that demonstrates how to work with overloaded operators in
more detail.
Callbacks and passing anonymous functions Callbacks and passing anonymous functions
========================================= =========================================
@ -209,8 +210,9 @@ The following interactive session shows how to call them from Python.
This functionality is very useful when generating bindings for callbacks in This functionality is very useful when generating bindings for callbacks in
C++ libraries (e.g. GUI libraries, asynchronous networking libraries, etc.). C++ libraries (e.g. GUI libraries, asynchronous networking libraries, etc.).
The file :file:`example/example5.cpp` contains a complete example that The file :file:`example/example-callbacks.cpp` contains a complete example
demonstrates how to work with callbacks and anonymous functions in more detail. that demonstrates how to work with callbacks and anonymous functions in
more detail.
Overriding virtual functions in Python Overriding virtual functions in Python
====================================== ======================================
@ -347,9 +349,9 @@ Please take a look at the :ref:`macro_notes` before using this feature.
.. seealso:: .. seealso::
The file :file:`example/example12.cpp` contains a complete example that The file :file:`example/example-virtual-functions.cpp` contains a complete
demonstrates how to override virtual functions using pybind11 in more example that demonstrates how to override virtual functions using pybind11
detail. in more detail.
.. _macro_notes: .. _macro_notes:
@ -433,8 +435,8 @@ out of the box with just the core :file:`pybind11/pybind11.h` header.
.. seealso:: .. seealso::
The file :file:`example/example2.cpp` contains a complete example that The file :file:`example/example-python-types.cpp` contains a complete
demonstrates how to pass STL data types in more detail. example that demonstrates how to pass STL data types in more detail.
Binding sequence data types, iterators, the slicing protocol, etc. Binding sequence data types, iterators, the slicing protocol, etc.
================================================================== ==================================================================
@ -443,10 +445,10 @@ Please refer to the supplemental example for details.
.. seealso:: .. seealso::
The file :file:`example/example6.cpp` contains a complete example that The file :file:`example/example-sequences-and-iterators.cpp` contains a
shows how to bind a sequence data type, including length queries complete example that shows how to bind a sequence data type, including
(``__len__``), iterators (``__iter__``), the slicing protocol and other length queries (``__len__``), iterators (``__iter__``), the slicing
kinds of useful operations. protocol and other kinds of useful operations.
Return value policies Return value policies
===================== =====================
@ -630,8 +632,8 @@ might be declared as follows:
.. seealso:: .. seealso::
The file :file:`example/example13.cpp` contains a complete example that The file :file:`example/example-keep-alive.cpp` contains a complete example
demonstrates using :class:`keep_alive` in more detail. that demonstrates using :class:`keep_alive` in more detail.
Implicit type conversions Implicit type conversions
========================= =========================
@ -832,9 +834,9 @@ Please take a look at the :ref:`macro_notes` before using this feature.
.. seealso:: .. seealso::
The file :file:`example/example8.cpp` contains a complete example that The file :file:`example/example-smart-ptr.cpp` contains a complete example
demonstrates how to work with custom reference-counting holder types in that demonstrates how to work with custom reference-counting holder types
more detail. in more detail.
.. _custom_constructors: .. _custom_constructors:
@ -939,7 +941,7 @@ a first shot at handling the exception).
Inside the translator, ``std::rethrow_exception`` should be used within Inside the translator, ``std::rethrow_exception`` should be used within
a try block to re-throw the exception. A catch clause can then use a try block to re-throw the exception. A catch clause can then use
``PyErr_SetString`` to set a Python exception as demonstrated ``PyErr_SetString`` to set a Python exception as demonstrated
in :file:`example19.cpp``. in :file:`example-custom-exceptions.cpp``.
This example also demonstrates how to create custom exception types This example also demonstrates how to create custom exception types
with ``py::exception``. with ``py::exception``.
@ -1077,9 +1079,9 @@ Please take a look at the :ref:`macro_notes` before using this feature.
.. seealso:: .. seealso::
The file :file:`example/example14.cpp` contains a complete example that The file :file:`example/example-opaque-types.cpp` contains a complete
demonstrates how to create and expose opaque types using pybind11 in more example that demonstrates how to create and expose opaque types using
detail. pybind11 in more detail.
.. _eigen: .. _eigen:
@ -1249,8 +1251,8 @@ limitations), refer to the section on :ref:`eigen`.
.. seealso:: .. seealso::
The file :file:`example/example7.cpp` contains a complete example that The file :file:`example/example-buffers.cpp` contains a complete example
demonstrates using the buffer protocol with pybind11 in more detail. that demonstrates using the buffer protocol with pybind11 in more detail.
.. [#f2] http://docs.python.org/3/c-api/buffer.html .. [#f2] http://docs.python.org/3/c-api/buffer.html
@ -1398,8 +1400,8 @@ simply using ``vectorize``).
.. seealso:: .. seealso::
The file :file:`example/example10.cpp` contains a complete example that The file :file:`example/example-numpy-vectorize.cpp` contains a complete
demonstrates using :func:`vectorize` in more detail. example that demonstrates using :func:`vectorize` in more detail.
Functions taking Python objects as arguments Functions taking Python objects as arguments
============================================ ============================================
@ -1462,9 +1464,10 @@ with other parameters.
.. seealso:: .. seealso::
The file :file:`example/example2.cpp` contains a complete example that The file :file:`example/example-python-types.cpp` contains a complete
demonstrates passing native Python types in more detail. The file example that demonstrates passing native Python types in more detail. The
:file:`example/example11.cpp` discusses usage of ``args`` and ``kwargs``. file :file:`example/example-arg-keywords-and-defaults.cpp` discusses usage
of ``args`` and ``kwargs``.
Default arguments revisited Default arguments revisited
=========================== ===========================
@ -1537,11 +1540,11 @@ Such functions can also be created using pybind11:
/// Binding code /// Binding code
m.def("generic", &generic); m.def("generic", &generic);
(See ``example/example11.cpp``). The class ``py::args`` derives from (See ``example/example-arg-keywords-and-defaults.cpp``). The class ``py::args``
``py::list`` and ``py::kwargs`` derives from ``py::dict`` Note that the derives from ``py::list`` and ``py::kwargs`` derives from ``py::dict`` Note
``kwargs`` argument is invalid if no keyword arguments were actually provided. that the ``kwargs`` argument is invalid if no keyword arguments were actually
Please refer to the other examples for details on how to iterate over these, provided. Please refer to the other examples for details on how to iterate
and on how to cast their entries into C++ objects. over these, and on how to cast their entries into C++ objects.
Partitioning code over multiple extension modules Partitioning code over multiple extension modules
================================================= =================================================
@ -1682,8 +1685,9 @@ memory corruption and/or segmentation faults.
.. seealso:: .. seealso::
The file :file:`example/example15.cpp` contains a complete example that The file :file:`example/example-pickling.cpp` contains a complete example
demonstrates how to pickle and unpickle types using pybind11 in more detail. that demonstrates how to pickle and unpickle types using pybind11 in more
detail.
.. [#f3] http://docs.python.org/3/library/pickle.html#pickling-class-instances .. [#f3] http://docs.python.org/3/library/pickle.html#pickling-class-instances