Use of Boost library classes in kdecore?
David Jarvie
lists at astrojar.org.uk
Sat Jul 7 23:20:36 BST 2007
On Saturday 07 July 2007 12:26:24 David Jarvie wrote:
> On Saturday 07 July 2007 05:57:03 Thomas Zander wrote:
> > Bottom line; I would really dislike using boost in kdelibs. Not that I
> > have anything against boost per-see. But lets please keep the level of
> > complexity (learning new stuff) to a minimum so people can actually roll
> > into hacking on kdelibs a bit easier. Just because you like boost
> > doesn't mean all the potential kdelibs hackers should learn to use it.
>
> I'll go for the ref-counted d-pointer instead. Because there will no longer
> be any need to cope with implicit conversions of ref-counted classes, it
> should hopefully be possible to implement it using
> QExplicitlySharedDataPointer as Thiago suggested.
Having looked at implementing this, I realise that it won't work. The
KTimeZone base class objects provided by the API must be polymorphic, i.e. a
KTimeZone object/pointer must act like a pointer to that it can represent any
derived class object as well, and call the appropriate virtual functions.
Giving KTimeZone a QExplicitlySharedDataPointer d-pointer doesn't provide
this, and would still be necessary to use pointers to KTimeZone to achieve
polymorphism, which bypasses the ref-counting and is no better than the
current implementation. So I come back to the original proposal, to use Boost
classes which AFAICS provide polymorphic ref-counted pointers. It's either
that or writing stuff from scratch which would be probably result in a buggy
implementation given that ref-counted pointer classes have many potential
pitfalls.
--
David Jarvie.
KAlarm author and maintainer.
http://www.astrojar.org.uk/kalarm
More information about the kde-core-devel
mailing list