New shared pointer -- googled

Frerich Raabe raabe at kde.org
Sat Sep 10 03:15:33 BST 2005


On Friday 09 September 2005 23:50, Stefan Teleman wrote:
> On Friday 09 September 2005 19:24, Stefan Teleman wrote:
> > hang on, i think i have a CD copy of the book somewhere and i can just
> > copy and paste it to you. i need to do an excavation and find the CD.
> > stay tuned. :-)
>
> not that i like quoting myself -- but i googled it and here> it is: 
> http://www.aristeia.com/BookErrata/M29Source_frames.html

Ah yes, that's interesting - thank you for looking it up (I googled as well 
but apparently you have the mojo). That implementation has some subtle 
differences though:

It uses a 'unshareable' flag (the StringValue example demonstrates that this 
is useful in case somebody holds a reference into a container), that flag 
causes a silent copy when copying RCPtrs.
For instance, if 'a' is an RCPtr which is marked as unshareable, then 
'RCPtr<Foo> b = a' will cause a deep copy. I don't think that should break 
software which uses the old KSharedPtr though, since you'd have to 
explicitely mark a pointer as unshareable.

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.

> i also have 2 pdf's (from chapter 28 from MEC++) -- may i email them to you
> (bzipped) ? -- these have the type conversion implementation.

That would be nice. I think when doing a test-compile of kdecore I actually 
have a case or two where type conversions would have been useful.

- Frerich
-------------- 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/f33e81dc/attachment.sig>


More information about the kde-core-devel mailing list