diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-10-19 10:35:38 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-11-14 08:58:57 +0000 |
commit | 0b20348321b0c5663e46f293ed0ceb3c68594e63 (patch) | |
tree | 8837fab4118f553fc6813d27562bb06f77f81fd3 /src | |
parent | b257f032350c555ea52a7dad5a52d0312ab93b5c (diff) | |
download | qtxmlpatterns-0b20348321b0c5663e46f293ed0ceb3c68594e63.tar.gz |
Fix clazy-temporary-iterator
Change-Id: I512ffb927cfa161fc810c846a7b57b02601b14b9
Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/xmlpatterns/expr/qexpressionsequence.cpp | 10 | ||||
-rw-r--r-- | src/xmlpatterns/functions/qconstructorfunctionsfactory.cpp | 5 | ||||
-rw-r--r-- | src/xmlpatterns/functions/qfunctionfactorycollection.cpp | 5 |
3 files changed, 11 insertions, 9 deletions
diff --git a/src/xmlpatterns/expr/qexpressionsequence.cpp b/src/xmlpatterns/expr/qexpressionsequence.cpp index 193e15f..d796de4 100644 --- a/src/xmlpatterns/expr/qexpressionsequence.cpp +++ b/src/xmlpatterns/expr/qexpressionsequence.cpp @@ -46,6 +46,9 @@ #include "qexpressionsequence_p.h" +#include <algorithm> +#include <iterator> + QT_BEGIN_NAMESPACE using namespace QPatternist; @@ -109,11 +112,8 @@ Expression::Ptr ExpressionSequence::compress(const StaticContext::Ptr &context) else if(Id == IDExpressionSequence) { /* Rewrite "(1, (2, 3), 4)" into "(1, 2, 3, 4)" */ - Expression::List::const_iterator seqIt((*it)->operands().constBegin()); - const Expression::List::const_iterator seqEnd((*it)->operands().constEnd()); - - for(; seqIt != seqEnd; ++seqIt) - result.append(*seqIt); + const auto &operands = (*it)->operands(); + std::copy(operands.cbegin(), operands.cend(), std::back_inserter(result)); } else if (Id == IDLiteralSequence) { /* Rewrite "(1, (2, 3), 4)" into "(1, 2, 3, 4)" */ // Note: LiteralSequence does not use the dynamic context, so we pass in a nullptr. diff --git a/src/xmlpatterns/functions/qconstructorfunctionsfactory.cpp b/src/xmlpatterns/functions/qconstructorfunctionsfactory.cpp index 67c9e84..10d5829 100644 --- a/src/xmlpatterns/functions/qconstructorfunctionsfactory.cpp +++ b/src/xmlpatterns/functions/qconstructorfunctionsfactory.cpp @@ -58,8 +58,9 @@ ConstructorFunctionsFactory::ConstructorFunctionsFactory(const NamePool::Ptr &np { Q_ASSERT(m_typeFactory); Q_ASSERT(np); - SchemaType::Hash::const_iterator it(m_typeFactory->types().constBegin()); - const SchemaType::Hash::const_iterator end(m_typeFactory->types().constEnd()); + const auto &schemaHash = m_typeFactory->types(); + SchemaType::Hash::const_iterator it(schemaHash.constBegin()); + const SchemaType::Hash::const_iterator end(schemaHash.constEnd()); FunctionArgument::List args; const QXmlName argName(StandardNamespaces::empty, StandardLocalNames::sourceValue); diff --git a/src/xmlpatterns/functions/qfunctionfactorycollection.cpp b/src/xmlpatterns/functions/qfunctionfactorycollection.cpp index 6c10425..1deb3cc 100644 --- a/src/xmlpatterns/functions/qfunctionfactorycollection.cpp +++ b/src/xmlpatterns/functions/qfunctionfactorycollection.cpp @@ -92,8 +92,9 @@ FunctionSignature::Hash FunctionFactoryCollection::functionSignatures() const for(const_iterator it(constBegin()); it != e; ++it) { - const FunctionSignature::Hash::const_iterator e2((*it)->functionSignatures().constEnd()); - FunctionSignature::Hash::const_iterator sit((*it)->functionSignatures().constBegin()); + const auto &signatures = (*it)->functionSignatures(); + const FunctionSignature::Hash::const_iterator e2(signatures.constEnd()); + FunctionSignature::Hash::const_iterator sit(signatures.constBegin()); for(; sit != e2; ++sit) result.insert(sit.key(), sit.value()); |