QEventLoopLocker: add move SMFs and swap()
[ChangeLog][QEventLoopLocker] Added move special-member-functions and swap(). Fixes: QTBUG-115011 Change-Id: I81a31133adafa31904e8b7c49015506db8c161c6 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
d8a8a3a5dc
commit
c2956f8f76
|
|
@ -383,6 +383,43 @@ QEventLoopLocker::QEventLoopLocker(QThread *thread) noexcept
|
|||
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn QEventLoopLocker::QEventLoopLocker(QEventLoopLocker &&other)
|
||||
\since 6.7
|
||||
|
||||
Move-constructs an event-loop locker from \a other. \a other will have a
|
||||
no-op destructor, while responsibility for preventing the
|
||||
QEventLoop/QThread/QCoreApplication from quitting is transferred to the new
|
||||
object.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QEventLoopLocker &QEventLoopLocker::operator=(QEventLoopLocker &&other)
|
||||
\since 6.7
|
||||
|
||||
Move-assigns this event-loop locker from \a other. \a other will have a
|
||||
no-op destructor, while responsibility for preventing the
|
||||
QEventLoop/QThread/QCoreApplication from quitting is transferred to this
|
||||
object.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QEventLoopLocker::swap(QEventLoopLocker &other)
|
||||
\since 6.7
|
||||
|
||||
Swaps the object and the state of this QEventLoopLocker with \a other.
|
||||
This operation is very fast and never fails.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QEventLoopLocker::swap(QEventLoopLocker &lhs, QEventLoopLocker &rhs)
|
||||
\relates QEventLoopLocker
|
||||
\since 6.7
|
||||
|
||||
Swaps the object and the state of \a lhs with \a rhs.
|
||||
This operation is very fast and never fails.
|
||||
*/
|
||||
|
||||
/*!
|
||||
Destroys this event loop locker object
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -61,6 +61,14 @@ public:
|
|||
Q_NODISCARD_CTOR Q_CORE_EXPORT explicit QEventLoopLocker(QThread *thread) noexcept;
|
||||
Q_CORE_EXPORT ~QEventLoopLocker();
|
||||
|
||||
Q_NODISCARD_CTOR QEventLoopLocker(QEventLoopLocker &&other) noexcept
|
||||
: p{std::exchange(other.p, 0)} {}
|
||||
QEventLoopLocker &operator=(QEventLoopLocker &&other) noexcept
|
||||
{ auto moved = std::move(other); swap(moved); return *this; }
|
||||
|
||||
void swap(QEventLoopLocker &other) noexcept { std::swap(p, other.p); }
|
||||
friend void swap(QEventLoopLocker &lhs, QEventLoopLocker &rhs) noexcept { lhs.swap(rhs); }
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(QEventLoopLocker)
|
||||
friend class QEventLoopLockerPrivate;
|
||||
|
|
|
|||
Loading…
Reference in New Issue