From 5ffa5808f8b5cdc49242414006fd7b68cb2a1c12 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 14 May 2020 17:51:41 +0200 Subject: QTaggedPointer: some API cleanups - don't refer to the class with template arguments in the body of the class (incl. one where we got the template args wrong) - make namespace-level swap a non-member friend - make default ctor constexpr and non-explicit (default ctors should never be explicit) - make ctor from std::nullptr_t constexpr - remove op= from std::nullptr (will be handled by op=(T*) anyway) - pass QTaggedPointer by value (it's a Trivial Type, so can be passed in registers) - fix missing QTypeInfo for non-default Tag types - remove unused include limits.h - make qHash-able (why is the tag ignored?) Change-Id: Idee1d685ac365c988698a8637fd5df3accfc1396 Reviewed-by: Thiago Macieira --- src/corelib/tools/qtaggedpointer.qdoc | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'src/corelib/tools/qtaggedpointer.qdoc') diff --git a/src/corelib/tools/qtaggedpointer.qdoc b/src/corelib/tools/qtaggedpointer.qdoc index 5b335e8739..303b89232c 100644 --- a/src/corelib/tools/qtaggedpointer.qdoc +++ b/src/corelib/tools/qtaggedpointer.qdoc @@ -92,6 +92,18 @@ */ +/*! + \fn template QTaggedPointer::QTaggedPointer() + + Creates a tagged pointer that contains nullptr and stores no tag. +*/ + +/*! + \fn template QTaggedPointer::QTaggedPointer(std::nullptr_t) + + Creates a tagged pointer that contains nullptr and stores no tag. +*/ + /*! \fn template explicit QTaggedPointer::QTaggedPointer(T *pointer = nullptr, Tag tag = Tag()) noexcept @@ -159,7 +171,7 @@ */ /*! - \fn template inline bool operator==(const QTaggedPointer &lhs, const QTaggedPointer &rhs) noexcept + \fn template inline bool operator==(QTaggedPointer lhs, QTaggedPointer rhs) noexcept \relates QTaggedPointer Returns \c true if \a lhs is equal to \a rhs; otherwise returns \c false. @@ -168,7 +180,7 @@ */ /*! - \fn template inline bool operator!=(const QTaggedPointer &lhs, const QTaggedPointer &rhs) noexcept + \fn template inline bool operator!=(QTaggedPointer lhs, QTaggedPointer rhs) noexcept \relates QTaggedPointer Returns \c true if \a lhs is not equal to \a rhs; otherwise returns \c false. @@ -177,30 +189,36 @@ */ /*! - \fn template inline bool operator==(const QTaggedPointer &lhs, std::nullptr_t) noexcept + \fn template inline bool operator==(QTaggedPointer lhs, std::nullptr_t) noexcept \relates QTaggedPointer Returns \c true if \a lhs refers to \c nullptr. */ /*! - \fn template inline bool operator==(std::nullptr_t, const QTaggedPointer &rhs) noexcept + \fn template inline bool operator==(std::nullptr_t, QTaggedPointer rhs) noexcept \relates QTaggedPointer Returns \c true if \a rhs refers to \c nullptr. */ /*! - \fn template inline bool operator!=(const QTaggedPointer &lhs, std::nullptr_t) noexcept + \fn template inline bool operator!=(QTaggedPointerlhs, std::nullptr_t) noexcept \relates QTaggedPointer Returns \c true if \a lhs refers to a valid (i.e. non-null) pointer. */ /*! - \fn template inline bool operator!=(std::nullptr_t, const QTaggedPointer &rhs) noexcept + \fn template inline bool operator!=(std::nullptr_t, QTaggedPointer rhs) noexcept \relates QTaggedPointer Returns \c true if \a rhs refers to a valid (i.e. non-null) pointer. */ +/*! + \fn template qHash(QTaggedPointer key, std::size_t seed) + \relates QTaggedPointer + + Returns the hash value for the \a key, using \a seed to seed the calculation. +*/ -- cgit v1.2.3