diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2022-09-26 17:38:14 +0200 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2022-09-28 17:39:21 +0000 |
commit | a0dfa8c4d29a005009d04dcb52452efb9d74e26e (patch) | |
tree | 7b400e7a8fc2dd2db99d780e94ff4bf1b63ce375 /src/gui/painting | |
parent | d06d22fbc0ef1d070408fe7e1f6a5c33e6f8c4e2 (diff) |
Replace qExchange calls with std::exchange
qExchange is one of the few remaining functionalities that have not been
moved out of qglobal. Given that std::exchange exists in the standard, we
can simply move to it everywhere...
...if it weren't for the fact that std::exchange is only constexpr in
C++20, and only has its noexceptness specified in (most likely) C++23.
Still, we want to move to the existing std functionality where
possible, to allow the removal of qglobal includes in lieu of something
more fine-grained in the future.
So leave any constexpr calls[1] alone for now (and observe that none of
our current usages cares about the conditional noexceptness), but
replace everything else.
[1] QScopedValueRollback' ctor and QExplicitlySharedDataPointerV2::take
Task-number: QTBUG-99313
Change-Id: I599cb9846cf319c7ffd3457130938347a75aad25
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/gui/painting')
-rw-r--r-- | src/gui/painting/qpen.h | 2 | ||||
-rw-r--r-- | src/gui/painting/qregion.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/painting/qpen.h b/src/gui/painting/qpen.h index d8f13df388..2f38098496 100644 --- a/src/gui/painting/qpen.h +++ b/src/gui/painting/qpen.h @@ -35,7 +35,7 @@ public: QPen &operator=(const QPen &pen) noexcept; QPen(QPen &&other) noexcept - : d(qExchange(other.d, nullptr)) {} + : d(std::exchange(other.d, nullptr)) {} QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPen) void swap(QPen &other) noexcept { qt_ptr_swap(d, other.d); } diff --git a/src/gui/painting/qregion.h b/src/gui/painting/qregion.h index c946287411..b0051b6067 100644 --- a/src/gui/painting/qregion.h +++ b/src/gui/painting/qregion.h @@ -34,7 +34,7 @@ public: QRegion(const QPolygon &pa, Qt::FillRule fillRule = Qt::OddEvenFill); QRegion(const QRegion ®ion); QRegion(QRegion &&other) noexcept - : d(qExchange(other.d, const_cast<QRegionData*>(&shared_empty))) {} + : d(std::exchange(other.d, const_cast<QRegionData*>(&shared_empty))) {} QRegion(const QBitmap &bitmap); ~QRegion(); QRegion &operator=(const QRegion &); |