changing the parent of a KConfigGroup
Alex Merry
huntedhacker at tiscali.co.uk
Thu Jan 3 14:53:04 GMT 2008
On Thursday 03 January 2008, Oswald Buddenhagen wrote:
> On Wed, Jan 02, 2008 at 09:07:23AM -0600, Thomas Braxton wrote:
> > invalid group"); + Q_ASSERT(other != 0);
> > +
> > + if (dynamic_cast<KConfigGroup*>(other)) {
> > + KConfigGroup * otherGroup =
> > dynamic_cast<KConfigGroup*>(other);
>
> repeating the dyncast isn't particularly efficient.
> really nice c++ looks like this:
> if (KConfigGroup *otherGroup = dynamic_cast<KConfigGroup*>(other))
> { if you want to live more on the readable side, make the assignments
> outside the ifs and use nested ifs instead of an else-if cascade.
Surely if the dymanic cast has already worked, you can just use a static
cast the second time?
Alex
--
KDE: http://www.kde.org
Ubuntu/Kubuntu: http://www.ubuntu.org http://www.kubuntu.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080103/5b322d77/attachment.sig>
More information about the kde-core-devel
mailing list