diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-12-20 21:45:11 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2023-01-18 13:24:14 +0000 |
commit | df78bd62c3125366ce946274c0486090fd241466 (patch) | |
tree | 916dacae7f238424229b7970d0cd758dd780d99c | |
parent | 8b392c5f7681096e3248c04799d9670ddb9b9217 (diff) |
[doc] QSharedPointer: add some missing docs
Added docs for
- move-ctor, -assignment operator
- move-construction and -assignment from QSP<X>
- qHash()
There's more stuff missing, but I declare 'twas enough qdoc wrangling
for this round.
The texts are taken from other smart pointer docs, esp. QESDP, so
they're consistent.
Manual conflict resolutions:
- swap() wasn't marked as noexcept in qsharedpointer.h, but is
in qsharedpointer_impl.h, so kept the Qt 6 version.
Fixes: QTBUG-83134
Fixes: QTBUG-63700
Change-Id: Iff980d043e1635ed6cfdd3113c68bc23f3a0bad7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5dc0f52e7047ca5927e6741fda554cb090184b71)
Reviewed-by: Samuel Ghinet <samuel.ghinet@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
-rw-r--r-- | src/corelib/tools/qsharedpointer.cpp | 49 | ||||
-rw-r--r-- | src/corelib/tools/qsharedpointer.h | 10 |
2 files changed, 58 insertions, 1 deletions
diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp index 7fe286fc5d..a0cfa0768d 100644 --- a/src/corelib/tools/qsharedpointer.cpp +++ b/src/corelib/tools/qsharedpointer.cpp @@ -479,6 +479,46 @@ */ /*! + \fn template <class T> QSharedPointer<T>::QSharedPointer(QSharedPointer &&other) + + Move-constructs a QSharedPointer instance, making it point at the same + object that \a other was pointing to. + + \since 5.4 +*/ + +/*! + \fn template <class T> QSharedPointer<T>::operator=(QSharedPointer &&other) + + Move-assigns \a other to this QSharedPointer instance. + + \since 5.0 +*/ + +/*! + \fn template <class T> template <class X> QSharedPointer<T>::QSharedPointer(QSharedPointer<X> &&other) + + Move-constructs a QSharedPointer instance, making it point at the same + object that \a other was pointing to. + + This constructor participates in overload resolution only if \c{X*} + implicitly converts to \c{T*}. + + \since 5.6 +*/ + +/*! + \fn template <class T> template <class X> QSharedPointer<T>::operator=(QSharedPointer<X> &&other) + + Move-assigns \a other to this QSharedPointer instance. + + This assignment operator participates in overload resolution only if \c{X*} + implicitly converts to \c{T*}. + + \since 5.6 +*/ + +/*! \fn template <class T> QSharedPointer<T>::QSharedPointer(const QWeakPointer<T> &other) Creates a QSharedPointer by promoting the weak reference \a other @@ -932,6 +972,15 @@ */ /*! + \fn template <class T> qHash(const QSharedPointer<T> &key, size_t seed) + \relates QSharedPointer + + Returns the hash value for \a key, using \a seed to seed the calculation. + + \since 5.0 +*/ + +/*! \fn template <class T> template <class X> bool operator==(const QSharedPointer<T> &ptr1, const QSharedPointer<X> &ptr2) \relates QSharedPointer diff --git a/src/corelib/tools/qsharedpointer.h b/src/corelib/tools/qsharedpointer.h index 15a4f26880..c1c926edb0 100644 --- a/src/corelib/tools/qsharedpointer.h +++ b/src/corelib/tools/qsharedpointer.h @@ -82,7 +82,12 @@ public: QSharedPointer<T> &operator=(const QSharedPointer<T> &other); QSharedPointer<T> &operator=(const QWeakPointer<T> &other); - void swap(QSharedPointer<T> &other); + template <class X> + QSharedPointer(QSharedPointer<X> && other) noexcept; + template <class X> + QSharedPointer &operator=(QSharedPointer<X> && other) noexcept; + + void swap(QSharedPointer<T> &other) noexcept; QWeakPointer<T> toWeakRef() const; @@ -104,6 +109,9 @@ public: }; template <class T> +size_t qHash(const QSharedPointer<T> &key, size_t seed = 0) noexcept; + +template <class T> class QWeakPointer { public: |