From 1a7d3700a665a5ae29c8bab67ddc7fee7040b731 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Wed, 8 Apr 2020 20:14:04 -0400 Subject: 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 --- libqpdf/QPDF_Array.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'libqpdf/QPDF_Array.cc') 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& 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); } } -- cgit v1.2.3-54-g00ecf