diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2014-03-09 11:46:26 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-03 22:35:57 +0200 |
commit | e3a8e242ada146b1ec796424696e6c3964ab36dc (patch) | |
tree | 2247cea75ee30120b0e16fc007f0608092f87201 /src/corelib/tools/qsharedpointer_impl.h | |
parent | ef2a2a9c03b6cce57375bd998633d759a4ec1b3f (diff) |
QWeakPointer: add lock() for std::weak_ptr compatibility
[ChangeLog][QtCore][QWeakPointer] Added lock() method for std::weak_ptr compatibility.
Change-Id: I0851d91c51f5a4f04a855a1d8082234ce38396b4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qsharedpointer_impl.h')
-rw-r--r-- | src/corelib/tools/qsharedpointer_impl.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index c077b84492..e59efce7ae 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -639,6 +639,8 @@ public: inline void clear() { *this = QWeakPointer(); } inline QSharedPointer<T> toStrongRef() const { return QSharedPointer<T>(*this); } + // std::weak_ptr compatibility: + inline QSharedPointer<T> lock() const { return toStrongRef(); } #if defined(QWEAKPOINTER_ENABLE_ARROW) inline T *operator->() const { return data(); } |