From kde-core-devel Tue Jul 08 02:19:59 2008 From: Thiago Macieira Date: Tue, 08 Jul 2008 02:19:59 +0000 To: kde-core-devel Subject: Re: KDE/kdelibs/kdecore Message-Id: <200807072319.59832.thiago () kde ! org> X-MARC-Message: https://marc.info/?l=kde-core-devel&m=121548369522670 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--nextPart3196948.LGRURbIs6U" --nextPart3196948.LGRURbIs6U Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Andreas Pakulat wrote: >I'm not sure why the const_this is needed here anyway, shouldn't a > simple const_iterator and ::constEnd() be sufficient too? It's needed because of the missing constFind() function. There are two=20 overloads to find(): one non-const returning an iterator and a const=20 returning a const_iterator. The only way to select the const version (and=20 hence avoid detaching) is to have a const container. That is accomplished by having a const KMacroMapExpander, because that=20 makes its member variables also const. In general, mixing iterators is bad and can lead to errors. Qt provides a=20 macro (QT_STRICT_ITERATORS) that will make comparisons between iterators=20 and const_iterators fail, so you catch those mistakes. Also, if you took foo.find(), you should use foo.end() [which is what your= =20 patch does], instead of taking another path to "foo". =2D-=20 =A0 Thiago Macieira =A0- =A0thiago (AT) macieira.info - thiago (AT) kde.org =A0 =A0 PGP/GPG: 0x6EF45358; fingerprint: =A0 =A0 E067 918B B660 DBD1 105C =A0966C 33F5 F005 6EF4 5358 --nextPart3196948.LGRURbIs6U Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iD8DBQBIcs7PM/XwBW70U1gRAnVPAKCqpUYAibycZtVtFNRS/KyuGMCmFgCgsQ/y W/PMF9SWA3Tt3a/DpCht/X8= =uQqZ -----END PGP SIGNATURE----- --nextPart3196948.LGRURbIs6U--