aboutsummaryrefslogtreecommitdiffstats
path: root/3rdparty/pybind11/tests/test_opaque_types.cpp
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/pybind11/tests/test_opaque_types.cpp')
-rw-r--r--3rdparty/pybind11/tests/test_opaque_types.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/3rdparty/pybind11/tests/test_opaque_types.cpp b/3rdparty/pybind11/tests/test_opaque_types.cpp
index 5a234316..0386dba0 100644
--- a/3rdparty/pybind11/tests/test_opaque_types.cpp
+++ b/3rdparty/pybind11/tests/test_opaque_types.cpp
@@ -7,8 +7,10 @@
BSD-style license that can be found in the LICENSE file.
*/
-#include "pybind11_tests.h"
#include <pybind11/stl.h>
+
+#include "pybind11_tests.h"
+
#include <vector>
// IMPORTANT: Disable internal pybind11 translation mechanisms for STL data structures
@@ -26,12 +28,13 @@ TEST_SUBMODULE(opaque_types, m) {
.def(py::init<>())
.def("pop_back", &StringList::pop_back)
/* There are multiple versions of push_back(), etc. Select the right ones. */
- .def("push_back", (void (StringList::*)(const std::string &)) &StringList::push_back)
- .def("back", (std::string &(StringList::*)()) &StringList::back)
+ .def("push_back", (void(StringList::*)(const std::string &)) & StringList::push_back)
+ .def("back", (std::string & (StringList::*) ()) & StringList::back)
.def("__len__", [](const StringList &v) { return v.size(); })
- .def("__iter__", [](StringList &v) {
- return py::make_iterator(v.begin(), v.end());
- }, py::keep_alive<0, 1>());
+ .def(
+ "__iter__",
+ [](StringList &v) { return py::make_iterator(v.begin(), v.end()); },
+ py::keep_alive<0, 1>());
class ClassWithSTLVecProperty {
public:
@@ -44,9 +47,10 @@ TEST_SUBMODULE(opaque_types, m) {
m.def("print_opaque_list", [](const StringList &l) {
std::string ret = "Opaque list: [";
bool first = true;
- for (auto entry : l) {
- if (!first)
+ for (const auto &entry : l) {
+ if (!first) {
ret += ", ";
+ }
ret += entry;
first = false;
}