Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
pybind11
Commits
c769fce2
Commit
c769fce2
authored
Mar 03, 2016
by
Wenzel Jakob
Browse files
note about nullptr default args
parent
937d646b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
docs/advanced.rst
docs/advanced.rst
+9
-0
No files found.
docs/advanced.rst
View file @
c769fce2
...
@@ -1007,6 +1007,15 @@ default argument manually using the ``arg_t`` notation:
...
@@ -1007,6 +1007,15 @@ default argument manually using the ``arg_t`` notation:
py::class_<MyClass>("MyClass")
py::class_<MyClass>("MyClass")
.def("myFunction", py::arg_t<SomeType>("arg", SomeType(123), "SomeType(123)"));
.def("myFunction", py::arg_t<SomeType>("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>("MyClass")
.def("myFunction", py::arg("arg") = (SomeType *) nullptr);
Partitioning code over multiple extension modules
Partitioning code over multiple extension modules
=================================================
=================================================
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment