Use of Boost library classes in kdecore?
koos vriezen
koos.vriezen at gmail.com
Fri Jul 6 23:47:05 BST 2007
2007/7/7, David Jarvie <lists at astrojar.org.uk>:
> On Friday 06 July 2007 23:07:36 koos vriezen wrote:
> > 2007/7/7, David Jarvie <lists at astrojar.org.uk>:
> > > On Friday 06 July 2007 22:42:39 koos vriezen wrote:
> > > > Btw. how many timeszones are there anyhow?
> > >
> > > In an iCalendar file, I would guess that there would typically be only a
> > > small number. There could be other applications in the future which
> > > create a much larger number of instances (e.g. of KTzfileTimeZone, if
> > > historical information was required for system time zones).
> >
> > Ok, I thought there wouldn't be more than 24 unique ones, which would
> > make a map more obvious ..
>
> There are around 400 time zones in the system time zone database.
Still a candidate for create on demand, always return the same pointer
to the same timezone and never delete (but then again I have no idea
how big these are ..)
> > > > > typedef shared_ptr<KTimeZone> KTimeZonePtr;
> > > >
> > > > Note that this may add other headaches like a pointer ending in two
> > > > shared pointers
> > >
> > > I don't understand.
> > >
> > > > and the KTimeZone unaware of its own shared_ptr.
> > >
> > > The KTimeZone doesn't have a shared_ptr - it just contains the reference
> > > counter.
> >
> > Well if they already have a reference counter, why make another
> > shared_ptr of it.
>
> They don't currently have a reference counter - I'm proposing to add one.
>
> > Unless you don't get my point, ie. difference between subclassing
> > KShared vs. shared_ptr, first is aware of it's shared ptr, second
> > isn't.
>
> I'm still unclear. Both of them are aware that their pointers are to a shared
> data object. The two classes appear to be similar, except that KSharedPtr is
> more limited than shared_ptr, and if it were to be used would need to be
> subclassed to add the necessary facilities which shared_ptr already has.
No the KShared one can use 'this' to pass to functions that want to
store and reference that object. An object that has its 'this' pointer
in a shared_ptr can't do that.
Koos
More information about the kde-core-devel
mailing list