diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-07-12 17:29:52 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-07-12 18:18:13 +0000 |
commit | aceee8e737fc44e95963ed82e6b33874c8a3a851 (patch) | |
tree | 98b807d512656a10f7d16884cd4ed13f34f2104f /sources | |
parent | 43eb68918ce001d15592ad518e06dcea35896125 (diff) |
PySide6: Avoid unnecessary copies in container conversions
Use const-ref instead of a value.
Change-Id: I21a55a6c759e7c5897aade6dec09710a93a7a3b9
Reviewed-by: Christian Tismer <tismer@stackless.com>
(cherry picked from commit fb1f90eea7054a97a25ab8a63b661b35a6ff3c6f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'sources')
-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); |