KSharedPtr

Patrick Julien freak at codepimps.org
Sun Oct 13 22:45:58 BST 2002


After talking to Tim Jansen, I'm forwarding to kde-core-devel...

The documentation for KSharedPtr says it emulates a C++ pointer perfectly.  
However, the following code does not compile without the attached patch.  
This code would compile fine with a regular pointer.

#include <ksharedptr.h>
class A : public KShared {};
class B : public A {};
void test(KSharedPtr<A> a) {}

int main()
{
  KSharedPtr<B> b = new B;
  KSharedPtr<A> a = b; // Does not compile

  test(b); // Does not compile 
  a = b;  // Does not compile

  return 0;
}

The attached patch fixes both problems... KSharedPtr still doesn't emulate a 
C++ pointer perfectly, but at least fixes my personal pet peeves.

P.S.  I don't subscribe to kde-core-devel.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ksharedptr2.patch
Type: text/x-diff
Size: 982 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20021013/b6a1ce9c/attachment.patch>


More information about the kde-core-devel mailing list