From c769fce28001167310a747d417aa0856a98efcc7 Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Thu, 3 Mar 2016 12:03:30 +0100 Subject: [PATCH] note about nullptr default args --- docs/advanced.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/advanced.rst b/docs/advanced.rst index 1c2e4f48..f23ac53f 100644 --- a/docs/advanced.rst +++ b/docs/advanced.rst @@ -1007,6 +1007,15 @@ default argument manually using the ``arg_t`` notation: py::class_("MyClass") .def("myFunction", py::arg_t("arg", SomeType(123), "SomeType(123)")); +Sometimes it may be necessary to pass a null pointer value as a default +argument. In this case, remember to cast it to the underlying type in question, +like so: + +.. code-block:: cpp + + py::class_("MyClass") + .def("myFunction", py::arg("arg") = (SomeType *) nullptr); + Partitioning code over multiple extension modules =================================================