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
cd4b49a2
Unverified
Commit
cd4b49a2
authored
Jun 17, 2021
by
Aaron Gokaslan
Committed by
GitHub
Jun 17, 2021
Browse files
Update py::kwargs examples to pass by reference (#3038)
parent
4c7697db
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
docs/advanced/functions.rst
docs/advanced/functions.rst
+2
-2
No files found.
docs/advanced/functions.rst
View file @
cd4b49a2
...
...
@@ -254,7 +254,7 @@ For instance, the following statement iterates over a Python ``dict``:
.. code-block:: cpp
void print_dict(py::dict dict) {
void print_dict(
const
py::dict
&
dict) {
/* Easily interact with Python types */
for (auto item : dict)
std::cout << "key=" << std::string(py::str(item.first)) << ", "
...
...
@@ -292,7 +292,7 @@ Such functions can also be created using pybind11:
.. code-block:: cpp
void generic(py::args args, py::kwargs kwargs) {
void generic(py::args args,
const
py::kwargs
&
kwargs) {
/// .. do something with args
if (kwargs)
/// .. do something with kwargs
...
...
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