diff options
author | Jay Berkenbilt <ejb@ql.org> | 2020-04-09 02:14:04 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2020-04-09 02:45:26 +0200 |
commit | 1a7d3700a665a5ae29c8bab67ddc7fee7040b731 (patch) | |
tree | 625e79f255f5c57ea438816cb7714628ca0c66a2 /libqpdf/QPDF_Array.cc | |
parent | b89b1d772db935ed36b8abe8a21ee6468ada3d23 (diff) | |
download | qpdf-1a7d3700a665a5ae29c8bab67ddc7fee7040b731.tar.zst |
Fix unnecessary copies in auto iter (fixes #426)
Also switch to colon-style iteration in some cases. Thanks to Dean
Scarff for drawing this to my attention after detecting some
unnecessary copies with
https://clang.llvm.org/extra/clang-tidy/checks/performance-for-range-copy.html
Diffstat (limited to 'libqpdf/QPDF_Array.cc')
-rw-r--r-- | libqpdf/QPDF_Array.cc | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/libqpdf/QPDF_Array.cc b/libqpdf/QPDF_Array.cc index 609e9d77..d2091fab 100644 --- a/libqpdf/QPDF_Array.cc +++ b/libqpdf/QPDF_Array.cc @@ -146,9 +146,8 @@ QPDF_Array::getElementsForShallowCopy() const void QPDF_Array::addExplicitElementsToList(std::list<QPDFObjectHandle>& l) const { - for (auto iter = this->elements.begin(); - iter != this->elements.end(); ++iter) + for (auto const& iter: this->elements) { - l.push_back((*iter).second); + l.push_back(iter.second); } } |