From c72bf262ea1f8eb80b7b4c9a56f6bd9e6f77cee4 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 19 Nov 2022 21:30:55 +0100 Subject: Introduce QT_NO_AS_CONST and mark QtBase free of it Change-Id: I680086e767fe6d5c69eb7103b26150293c69b175 Reviewed-by: Volker Hilsheimer --- src/corelib/global/qttypetraits.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qttypetraits.h b/src/corelib/global/qttypetraits.h index 1832a1a734..e8939e7d5f 100644 --- a/src/corelib/global/qttypetraits.h +++ b/src/corelib/global/qttypetraits.h @@ -23,6 +23,8 @@ constexpr std::underlying_type_t qToUnderlying(Enum e) noexcept return static_cast>(e); } +#ifndef QT_NO_AS_CONST + // this adds const to non-const objects (like std::as_const) template constexpr typename std::add_const::type &qAsConst(T &t) noexcept { return t; } @@ -30,6 +32,8 @@ constexpr typename std::add_const::type &qAsConst(T &t) noexcept { return t; template void qAsConst(const T &&) = delete; +#endif // QT_NO_AS_CONST + // like std::exchange template constexpr T qExchange(T &t, U &&newValue) -- cgit v1.2.3