Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-7519

Please add boost's 'enable_shared_from_this' functionality to QSharedPointer

XMLWordPrintable

      Boost includes the ability to retrieve the boost::shared_ptr from 'this' inside of a class method (but not a constructor).

      Can this functionality be available to QSharedPointer?

      In boost, this is done by deriving from a base class 'enabled_shared_from_this'. Inside of classes so derived, one can do things like this:

      void MyClass::method()
      {
      boost::shared_ptr<MyClass> s_ptr = shared_from_this();
      passToFunctionRequiringSmartPointer(s_ptr);
      }

      Comments about this here too:
      http://labs.trolltech.com/blogs/2009/08/25/count-with-me-how-many-smart-pointer-classes-does-qt-have/

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            tmacieir Thiago Macieira (closed Nokia identity) (Inactive)
            cmeyer Chris Meyer
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes