From 982ef5b494319bfaaa585cf0620a821dc3b7c642 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Tue, 3 May 2016 23:19:49 +0200 Subject: QSharedPointer/QWeakPointer/QScopedPointer: add comparison against nullptr Some constructors were added, but the comparison operators were missing. The STL has them, so we ought have them too. Change-Id: I030c14a3b355988f509716b4b1b1a835b3ab9481 Reviewed-by: Marc Mutz --- src/corelib/tools/qsharedpointer.cpp | 84 ++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) (limited to 'src/corelib/tools/qsharedpointer.cpp') diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp index 939a1bdffd..af09ef6f40 100644 --- a/src/corelib/tools/qsharedpointer.cpp +++ b/src/corelib/tools/qsharedpointer.cpp @@ -1147,6 +1147,90 @@ \a ptr1's, you will get a compiler error. */ +/*! + \fn bool operator==(const QSharedPointer &lhs, std::nullptr_t) + \relates QSharedPointer + \since 5.8 + + Returns \c true if the pointer referenced by \a lhs is a null pointer. + + \sa QSharedPointer::isNull() +*/ + +/*! + \fn bool operator==(std::nullptr_t, const QSharedPointer &rhs) + \relates QSharedPointer + \since 5.8 + + Returns \c true if the pointer referenced by \a rhs is a null pointer. + + \sa QSharedPointer::isNull() +*/ + +/*! + \fn bool operator!=(const QSharedPointer &lhs, std::nullptr_t) + \relates QSharedPointer + \since 5.8 + + Returns \c true if the pointer referenced by \a lhs is a valid (i.e. + non-null) pointer. + + \sa QSharedPointer::isNull() +*/ + +/*! + \fn bool operator!=(std::nullptr_t, const QSharedPointer &rhs) + \relates QSharedPointer + \since 5.8 + + Returns \c true if the pointer referenced by \a rhs is a valid (i.e. + non-null) pointer. + + \sa QSharedPointer::isNull() +*/ + +/*! + \fn bool operator==(const QWeakPointer &lhs, std::nullptr_t) + \relates QWeakPointer + \since 5.8 + + Returns \c true if the pointer referenced by \a lhs is a null pointer. + + \sa QWeakPointer::isNull() +*/ + +/*! + \fn bool operator==(std::nullptr_t, const QWeakPointer &rhs) + \relates QWeakPointer + \since 5.8 + + Returns \c true if the pointer referenced by \a rhs is a null pointer. + + \sa QWeakPointer::isNull() +*/ + +/*! + \fn bool operator!=(const QWeakPointer &lhs, std::nullptr_t) + \relates QWeakPointer + \since 5.8 + + Returns \c true if the pointer referenced by \a lhs is a valid (i.e. + non-null) pointer. + + \sa QWeakPointer::isNull() +*/ + +/*! + \fn bool operator!=(std::nullptr_t, const QWeakPointer &rhs) + \relates QWeakPointer + \since 5.8 + + Returns \c true if the pointer referenced by \a rhs is a valid (i.e. + non-null) pointer. + + \sa QWeakPointer::isNull() +*/ + /*! \fn bool operator!=(const QWeakPointer &ptr1, const QSharedPointer &ptr2) \relates QWeakPointer -- cgit v1.2.3