File indexing completed on 2025-01-18 10:07:40
0001
0002
0003
0004 #ifndef QTTYPETRAITS_H
0005 #define QTTYPETRAITS_H
0006
0007 #include <QtCore/qtconfigmacros.h>
0008 #include <QtCore/qtdeprecationmarkers.h>
0009
0010 #include <type_traits>
0011 #include <utility>
0012
0013 #if 0
0014 #pragma qt_class(QtTypeTraits)
0015 #pragma qt_sync_stop_processing
0016 #endif
0017
0018 QT_BEGIN_NAMESPACE
0019
0020
0021 template <typename Enum>
0022 constexpr std::underlying_type_t<Enum> qToUnderlying(Enum e) noexcept
0023 {
0024 return static_cast<std::underlying_type_t<Enum>>(e);
0025 }
0026
0027 #ifndef QT_NO_AS_CONST
0028 #if QT_DEPRECATED_SINCE(6, 6)
0029
0030
0031 template <typename T>
0032 QT_DEPRECATED_VERSION_X_6_6("Use std::as_const() instead.")
0033 constexpr typename std::add_const<T>::type &qAsConst(T &t) noexcept { return t; }
0034
0035 template <typename T>
0036 void qAsConst(const T &&) = delete;
0037
0038 #endif
0039 #endif
0040
0041 #ifndef QT_NO_QEXCHANGE
0042
0043
0044 template <typename T, typename U = T>
0045 constexpr T qExchange(T &t, U &&newValue)
0046 noexcept(std::conjunction_v<std::is_nothrow_move_constructible<T>,
0047 std::is_nothrow_assignable<T &, U>>)
0048 {
0049 T old = std::move(t);
0050 t = std::forward<U>(newValue);
0051 return old;
0052 }
0053
0054 #endif
0055
0056 namespace QtPrivate {
0057
0058
0059 template <typename T> struct type_dependent_false : std::false_type {};
0060 template <auto T> struct value_dependent_false : std::false_type {};
0061 }
0062
0063 QT_END_NAMESPACE
0064
0065 #endif