diff options
| author | Marc Mutz <marc.mutz@qt.io> | 2023-09-28 14:19:22 +0200 |
|---|---|---|
| committer | Marc Mutz <marc.mutz@qt.io> | 2023-10-05 19:40:02 +0200 |
| commit | b6c73356355de752755dc54214818dac6d0a8694 (patch) | |
| tree | 4d1f45da39df86db337d0c6d4911f08f8261f973 /src/corelib/kernel/qpointer.cpp | |
| parent | fc9d9c1a2b72bd6ff6e0300744dcead2a19a804c (diff) | |
QPointer: fix missing converting move-assignment operator
When 6c504f2519e1180dbcfd77d5bb08b0db9742eeaa added the conversion
copy-constructor to fix an ambiguity, its commit message argued at
length why a move-assignment conversion operator was not possible. But
we actually have the existing converting move and copy ctors, so we
can just use copy-and-swap and move-and-swap, so do that.
As a drive-by, make the copy-assignment operator use copy-and-swap.
[ChangeLog][QtCore][QPointer] Added missing converting move-assignment
operator. This is forwards-compatible with Qt 6.6.0: compiling against
6.6.0 will just use the lvalue overload.
This is BC and SC, forwards and backwards (inline code, and going back
in time will just use the lvalue overload), so picking to 6.6.
Pick-to: 6.6
Change-Id: Ibbefb0927c08d8c716a952c6c592a02df2a89008
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/kernel/qpointer.cpp')
| -rw-r--r-- | src/corelib/kernel/qpointer.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/corelib/kernel/qpointer.cpp b/src/corelib/kernel/qpointer.cpp index e426c63ae5f..bb6fcc287e2 100644 --- a/src/corelib/kernel/qpointer.cpp +++ b/src/corelib/kernel/qpointer.cpp @@ -123,6 +123,17 @@ */ /*! + \fn template <class T> template <class X> QPointer<T> &QPointer<T>::operator=(QPointer<X> &&other) + \since 6.6.1 + + Conversion move-assignment operator. Makes this guarded pointer guard the + same object guarded by \a other and resets \a other to nullptr. + + \note This operator participates in overload resolution only if \c{X*} + is convertible to \c{T*}. +*/ + +/*! \fn template <class T> void QPointer<T>::swap(QPointer &other) \since 5.6 |
