Is there a policy or recommendation for using new foreach keyword to iterat=
e =

Qt4 containers? The Qt documentation says that foreach makes a copy of the =

container (using implicit sharing), which should add tiny performance hit, =

unless you modify the container, in which case it will make a deep copy and =

you'll get bigger performance hit. Also, Qt docs suggest that STL-like =

iterators have the best performance. Has anyone done any performance =

testing? STL versus java-like iterators versus foreach.

It appears that pre-increment is still preferred over post-increment?, i.e.

QHash::iterator it =3D m_pooledFilterMgrs.begin(=
);
while (it !=3D m_pooledFilterMgrs.end()) {
// do something
++it;
}

but is this better?

QHash::iterator it =3D m_pooledFilterMgrs.begin(=
);
QHash::iterator itEnd =3D m_pooledFilterMgrs.end=
();
while (it !=3D itEnd) {
// do something
++it;
}

and of course const_iterator is preferred if you're not going to modify the =

container.

-- =

Gary Cramblitt (aka PhantomsDad)
KDE Text-to-Speech Maintainer
http://accessibility.kde.org/developer/kttsd/index.php
=

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscrib=

e <<