diff options
Diffstat (limited to 'src/corelib/tools/qsharedpointer.cpp')
-rw-r--r-- | src/corelib/tools/qsharedpointer.cpp | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp index 84afb0c5db..939a1bdffd 100644 --- a/src/corelib/tools/qsharedpointer.cpp +++ b/src/corelib/tools/qsharedpointer.cpp @@ -442,15 +442,20 @@ */ /*! - \fn QSharedPointer::QSharedPointer(T *ptr) + \fn QSharedPointer::QSharedPointer(X *ptr) Creates a QSharedPointer that points to \a ptr. The pointer \a ptr becomes managed by this QSharedPointer and must not be passed to another QSharedPointer object or deleted outside this object. + + Since Qt 5.8, when the last reference to this QSharedPointer gets + destroyed, \a ptr will be deleted by calling \c X's destructor (even if \c + X is not the same as QSharedPointer's template parameter \c T). Previously, + the destructor for \c T was called. */ /*! - \fn QSharedPointer::QSharedPointer(T *ptr, Deleter deleter) + \fn QSharedPointer::QSharedPointer(X *ptr, Deleter deleter) Creates a QSharedPointer that points to \a ptr. The pointer \a ptr becomes managed by this QSharedPointer and must not be passed to @@ -477,6 +482,9 @@ } \endcode + Note that the custom deleter function will be called with a pointer to type + \c X, even if the QSharedPointer template parameter \c T is not the same. + It is also possible to specify a member function directly, as in: \code QSharedPointer<MyObject> obj = @@ -487,6 +495,22 @@ */ /*! + \fn QSharedPointer::QSharedPointer(std::nullptr_t) + \since 5.8 + + Creates a QSharedPointer that is null. This is equivalent to the + QSharedPointer default constructor. +*/ + +/*! + \fn QSharedPointer::QSharedPointer(std::nullptr_t, Deleter) + \since 5.8 + + Creates a QSharedPointer that is null. This is equivalent to the + QSharedPointer default constructor. +*/ + +/*! \fn QSharedPointer::QSharedPointer(const QSharedPointer<T> &other) Creates a QSharedPointer object that shares \a other's pointer. |