diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-07-12 17:29:52 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-07-12 17:58:05 +0200 |
commit | fb1f90eea7054a97a25ab8a63b661b35a6ff3c6f (patch) | |
tree | 07940f8fb97550251b430081a2b20c8a2105cc4c | |
parent | 2289c796676fb172970489019f4f5315eb3225f4 (diff) |
PySide6: Avoid unnecessary copies in container conversions
Use const-ref instead of a value.
Pick-to: 6.1
Change-Id: I21a55a6c759e7c5897aade6dec09710a93a7a3b9
Reviewed-by: Christian Tismer <tismer@stackless.com>
-rw-r--r-- | sources/pyside6/PySide6/templates/core_common.xml | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sources/pyside6/PySide6/templates/core_common.xml b/sources/pyside6/PySide6/templates/core_common.xml index d3bedfc9f..2ba4cffa3 100644 --- a/sources/pyside6/PySide6/templates/core_common.xml +++ b/sources/pyside6/PySide6/templates/core_common.xml @@ -288,7 +288,7 @@ PyObject *%out = PyList_New(Py_ssize_t(%in.size())); Py_ssize_t idx = 0; for (auto it = %in.cbegin(), end = %in.cend(); it != end; ++it, ++idx) { - %INTYPE_0 cppItem(*it); + const auto &cppItem = *it; PyList_SET_ITEM(%out, idx, %CONVERTTOPYTHON[%INTYPE_0](cppItem)); } return %out; @@ -356,8 +356,8 @@ <template name="cppmap_to_pymap_conversion"> PyObject *%out = PyDict_New(); for (auto it = %in.cbegin(), end = %in.cend(); it != end; ++it) { - %INTYPE_0 key = it.key(); - %INTYPE_1 value = it.value(); + const auto &key = it.key(); + const auto &value = it.value(); PyObject *pyKey = %CONVERTTOPYTHON[%INTYPE_0](key); PyObject *pyValue = %CONVERTTOPYTHON[%INTYPE_1](value); PyDict_SetItem(%out, pyKey, pyValue); |