From 21cc71ced3565585f7a2f94875ed845355ab2064 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 4 Sep 2016 16:55:29 +0200 Subject: Eradicate Java-style loops (I): QHashIterator -> STL-style Java-style iterators are slower than STL-style ones, so they should not be used in library code. Replaced them with STL iterator loops. In one case, a QMutableHashIterator actually needn't be mutable, so ported to const_iterator, like all others. Change-Id: Ib7fd1fa5fca2df2c288a61925ee68a5df11caf62 Reviewed-by: Friedemann Kleint --- src/xmlpatterns/acceltree/qacceltree.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src/xmlpatterns/acceltree/qacceltree.cpp') diff --git a/src/xmlpatterns/acceltree/qacceltree.cpp b/src/xmlpatterns/acceltree/qacceltree.cpp index c68c3a4..1892745 100644 --- a/src/xmlpatterns/acceltree/qacceltree.cpp +++ b/src/xmlpatterns/acceltree/qacceltree.cpp @@ -122,11 +122,7 @@ void AccelTree::printStats(const NamePool::Ptr &np) const pDebug() << "+---------------+-------+-------+---------------+-------+--------------+"; pDebug() << "Namespaces(" << namespaces.count() << "):"; - QHashIterator > it(namespaces); - while(it.hasNext()) - { - it.next(); - + for (auto it = namespaces.cbegin(), end = namespaces.cend(); it != end; ++it) { pDebug() << "PreNumber: " << QString::number(it.key()); for(int i = 0; i < it.value().count(); ++i) pDebug() << "\t\t" << np->stringForPrefix(it.value().at(i).prefix()) << " = " << np->stringForNamespace(it.value().at(i).namespaceURI()); -- cgit v1.2.1