New shared pointer -- googled

Frerich Raabe raabe at kde.org
Sat Sep 10 03:54:41 BST 2005


On Saturday 10 September 2005 00:47, Stefan Teleman wrote:
> On Friday 09 September 2005 22:15, Frerich Raabe wrote:
> > Unfortunately that is a version of a reference-counting pointer uses an
> > internal reference count as well (anything which you want to use a RCPtr
> > on has to inherit RCObject), but the 'unshareable' thing is useful. I
> > don't know a single case in KDE where this is used (so I won't add it :-)
> > but it's good to be reminded of that.
>
> further down (the code examples which come from pages 209-210) there's an
> implementation for objects which cannot inherit from RCObject  (for example
> because these classes would come from a library for which one doesn't have
> access to the code) -- which i think is probably better because it removes
> the dependency on the RCObject base.

Ah yes - I did not see that. 'CountHolder' is derived from RCObject though - 
so I'm not sure why we cannot simply have CountHolder do what RCObject
does. Hmmm, maybe one possibility would be to have specialized templates, like 
- if T inherits RCObject then aggregate a T*, otherwise use a CountHolder*. 
That gives you the internal as well as the external reference count. I'm not 
sure I like such a weird pointer though. Right now it's simple and it's very 
clear what it does, I'm not sure I want to start pulling off funny 
tricks. :-}

- Frerich

P.S.: Thank you for the PDF files - I always enjoy reading his articles. :-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20050910/e607d483/attachment.sig>


More information about the kde-core-devel mailing list