From acbf7e6f808f806cdc15495070eb8fe3d191f1d3 Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Mon, 27 Feb 2023 10:27:29 -0600 Subject: [PATCH] App: Minor loop cleanup in Property.h As discussed in PR #8683 --- src/App/Property.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/App/Property.h b/src/App/Property.h index 058a036f35..a64dc8fe6e 100644 --- a/src/App/Property.h +++ b/src/App/Property.h @@ -552,21 +552,18 @@ protected: void setPyValues(const std::vector& vals, const std::vector& indices) override { - int i = 0; if (indices.empty()) { ListT values {}; - values.resize(vals.size()); - i = 0; - for (auto valsContent : vals) { - values[i] = getPyValue(valsContent); - i++; + values.reserve(vals.size()); + for (auto *valsContent : vals) { + values.push_back(getPyValue(valsContent)); } setValues(std::move(values)); return; } assert(vals.size() == indices.size()); atomic_change guard(*this); - i = 0; + int i {0}; for (auto index : indices) { set1Value(index, getPyValue(vals[i])); i++;