From 8529d7e3ace4994cd2caf563bb437f2c5c38bcee Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 28 Aug 2009 18:35:43 +0200 Subject: Add an opt-in QWeakPointer::operator->. To use this, you must add #define QWEAKPOINTER_ENABLE_ARROW to your .cpp before #including any headers. Be careful about adding this to .h files. Reviewed-by: Olivier Goffart --- src/corelib/tools/qsharedpointer_impl.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index e4f7ba9..a4282e1 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -626,6 +626,10 @@ public: inline QSharedPointer toStrongRef() const { return QSharedPointer(*this); } +#if defined(QWEAKPOINTER_ENABLE_ARROW) + inline T *operator->() const { return data(); } +#endif + private: #if defined(Q_NO_TEMPLATE_FRIENDS) -- cgit v0.12