Details
-
Suggestion
-
Resolution: Duplicate
-
P3: Somewhat important
-
4.6.1
-
None
Description
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/
Attachments
Issue Links
- is replaced by
-
QTBUG-7287 Have an equivalent to boost::enable_shared_from_this for QSharedPointer
-
- Closed
-