diff options
Diffstat (limited to 'src/corelib/tools/qpoint.h')
-rw-r--r-- | src/corelib/tools/qpoint.h | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/corelib/tools/qpoint.h b/src/corelib/tools/qpoint.h index 48c5e91f62..7df4d49005 100644 --- a/src/corelib/tools/qpoint.h +++ b/src/corelib/tools/qpoint.h @@ -6,12 +6,17 @@ #include <QtCore/qnamespace.h> +#include <QtCore/q20type_traits.h> +#include <QtCore/q23utility.h> + #if defined(Q_OS_DARWIN) || defined(Q_QDOC) struct CGPoint; #endif QT_BEGIN_NAMESPACE +QT_ENABLE_P0846_SEMANTICS_FOR(get) + class QPointF; class QPoint @@ -86,13 +91,13 @@ private: template <std::size_t I, typename P, std::enable_if_t<(I < 2), bool> = true, - std::enable_if_t<std::is_same_v<std::decay_t<P>, QPoint>, bool> = true> + std::enable_if_t<std::is_same_v<q20::remove_cvref_t<P>, QPoint>, bool> = true> friend constexpr decltype(auto) get(P &&p) noexcept { if constexpr (I == 0) - return (std::forward<P>(p).xp); + return q23::forward_like<P>(p.xp); else if constexpr (I == 1) - return (std::forward<P>(p).yp); + return q23::forward_like<P>(p.yp); } }; @@ -283,13 +288,13 @@ private: template <std::size_t I, typename P, std::enable_if_t<(I < 2), bool> = true, - std::enable_if_t<std::is_same_v<std::decay_t<P>, QPointF>, bool> = true> + std::enable_if_t<std::is_same_v<q20::remove_cvref_t<P>, QPointF>, bool> = true> friend constexpr decltype(auto) get(P &&p) noexcept { if constexpr (I == 0) - return (std::forward<P>(p).xp); + return q23::forward_like<P>(p.xp); else if constexpr (I == 1) - return (std::forward<P>(p).yp); + return q23::forward_like<P>(p.yp); } }; |