diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2020-05-14 17:51:41 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2020-05-15 20:00:24 +0200 |
commit | 5ffa5808f8b5cdc49242414006fd7b68cb2a1c12 (patch) | |
tree | b3083f4d155e11bf13c245845e1ab1b4cc9f1e22 /src/corelib/tools/qtaggedpointer.qdoc | |
parent | e5683c5e5ffe1a260b19f453b03451e48a352a54 (diff) |
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 <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qtaggedpointer.qdoc')
-rw-r--r-- | src/corelib/tools/qtaggedpointer.qdoc | 30 |
1 files changed, 24 insertions, 6 deletions
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 @@ -93,6 +93,18 @@ /*! + \fn template <typename T, typename Tag> QTaggedPointer<T, Tag>::QTaggedPointer() + + Creates a tagged pointer that contains nullptr and stores no tag. +*/ + +/*! + \fn template <typename T, typename Tag> QTaggedPointer<T, Tag>::QTaggedPointer(std::nullptr_t) + + Creates a tagged pointer that contains nullptr and stores no tag. +*/ + +/*! \fn template <typename T, typename Tag> explicit QTaggedPointer<T, Tag>::QTaggedPointer(T *pointer = nullptr, Tag tag = Tag()) noexcept Creates a tagged pointer that points to \a pointer and stores the specified \a tag. @@ -159,7 +171,7 @@ */ /*! - \fn template <typename T, typename Tag> inline bool operator==(const QTaggedPointer<T, Tag> &lhs, const QTaggedPointer<T, Tag> &rhs) noexcept + \fn template <typename T, typename Tag> 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 <typename T, typename Tag> inline bool operator!=(const QTaggedPointer<T, Tag> &lhs, const QTaggedPointer<T, Tag> &rhs) noexcept + \fn template <typename T, typename Tag> 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 <typename T, typename Tag> inline bool operator==(const QTaggedPointer<T, Tag> &lhs, std::nullptr_t) noexcept + \fn template <typename T, typename Tag> inline bool operator==(QTaggedPointer lhs, std::nullptr_t) noexcept \relates QTaggedPointer Returns \c true if \a lhs refers to \c nullptr. */ /*! - \fn template <typename T, typename Tag> inline bool operator==(std::nullptr_t, const QTaggedPointer<T, Tag> &rhs) noexcept + \fn template <typename T, typename Tag> inline bool operator==(std::nullptr_t, QTaggedPointer rhs) noexcept \relates QTaggedPointer Returns \c true if \a rhs refers to \c nullptr. */ /*! - \fn template <typename T, typename Tag> inline bool operator!=(const QTaggedPointer<T, Tag> &lhs, std::nullptr_t) noexcept + \fn template <typename T, typename Tag> 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 <typename T, typename Tag> inline bool operator!=(std::nullptr_t, const QTaggedPointer<T, Tag> &rhs) noexcept + \fn template <typename T, typename Tag> 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 <typename T, typename Tag> qHash(QTaggedPointer<T, Tag> key, std::size_t seed) + \relates QTaggedPointer + + Returns the hash value for the \a key, using \a seed to seed the calculation. +*/ |