diff options
Diffstat (limited to 'src/corelib/global/qttypetraits.h')
-rw-r--r-- | src/corelib/global/qttypetraits.h | 4 |
1 files changed, 4 insertions, 0 deletions
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<Enum> qToUnderlying(Enum e) noexcept return static_cast<std::underlying_type_t<Enum>>(e); } +#ifndef QT_NO_AS_CONST + // this adds const to non-const objects (like std::as_const) template <typename T> constexpr typename std::add_const<T>::type &qAsConst(T &t) noexcept { return t; } @@ -30,6 +32,8 @@ constexpr typename std::add_const<T>::type &qAsConst(T &t) noexcept { return t; template <typename T> void qAsConst(const T &&) = delete; +#endif // QT_NO_AS_CONST + // like std::exchange template <typename T, typename U = T> constexpr T qExchange(T &t, U &&newValue) |