[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.

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: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2022-12-20 21:45:11 +01:00 committed by Qt Cherry-pick Bot
parent 655eb08578
commit ee981bac2a
2 changed files with 57 additions and 0 deletions

View File

@ -442,6 +442,46 @@
get a compiler error.
*/
/*!
\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)
@ -895,6 +935,15 @@
Const overload of sharedFromThis().
*/
/*!
\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

View File

@ -48,6 +48,11 @@ public:
QSharedPointer<T> &operator=(QSharedPointer<T> &&other) noexcept;
QSharedPointer<T> &operator=(const QWeakPointer<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;
@ -69,6 +74,9 @@ public:
static inline QSharedPointer<T> create(Args &&... args);
};
template <class T>
size_t qHash(const QSharedPointer<T> &key, size_t seed = 0) noexcept;
template <class T>
class QWeakPointer
{