[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: "Fixed" post-increment operators on iterators
From:       Benjamin Meyer <ben () meyerhome ! net>
Date:       2004-10-31 17:39:47
Message-ID: 200410311239.48634.ben () meyerhome ! net
[Download RAW message or body]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sunday 31 October 2004 1:32 pm, Aaron J. Seigo wrote:
> On Sunday 31 October 2004 05:27, Esben Mose Hansen wrote:
> > On Sunday 31 October, 2004 12:59, Frederik Schmid wrote:
> > > > QStringList::ConstIterator itEnd = matches.end();
> > > > for(QStringList::ConstIterator it = matches.begin(); it != itEnd;
> > > > ++it) _keyList->insertItem(*it);
> >
> > [...]
> >
> > > The compiler will (almost certainly) move loop-conditions out ouf the
> > > loop, so no need to add extra lines in this case.
> >
> > I have always wondered about that. Unless the container is const, how can
> > the compiler know that mycontainer->end() always returns the same value?
>
> exactly, and so it won't, and so caching the return value of end() (or
> length(), or...) almost always results in a speedup (of how much and of
> what impact is another matter)
>
> > Also, why is it we don't use STL? The above could be written as
> > (untested)
>
> probably a combination of the fact that STL support on all the platforms
> people use KDE on has traditionally sucked and that many people aren't
> familiar with the STL.

At least with Qt4 we will have foreach.

- -Benjamin Meyer

- -- 
aka icefox
Public Key: http://www.icefox.net/public_key.asc
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFBhSNj1rZ3LTw38vIRAlTuAJ4vT0bAi3bZ3dVLjrPC60I9RtGKlACgnjtn
q0X9ySX16uJK2mWdfqqG7Ig=
=8VKj
-----END PGP SIGNATURE-----
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic