diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2023-01-27 11:59:30 +0100 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2023-03-10 17:40:49 +0100 |
commit | e64eaf57f31d40e8ac635527e51f1ca147d472d3 (patch) | |
tree | 17195ea84563f802ba7821f689ce20c9c90fdbcd | |
parent | 42612b0180fb91a275ca2c83b14a45d9ac5d37c3 (diff) | |
download | qtbase-e64eaf57f31d40e8ac635527e51f1ca147d472d3.tar.gz |
QTypeInfo: move helpers in QtPrivate namespace
qIsRelocatable and qIsValueInitializationBitwiseZero are not public API,
hide them away.
Change-Id: Ib4eeaab46d01759098e96091b700e9a28fd50962
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 0ca803a5d325f26f5e4e0fcab8b9c9a02f154336)
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
-rw-r--r-- | src/corelib/global/qtypeinfo.h | 12 | ||||
-rw-r--r-- | src/corelib/kernel/qvariant.h | 2 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/corelib/global/qtypeinfo.h b/src/corelib/global/qtypeinfo.h index 349382be46..b70e4ba9d4 100644 --- a/src/corelib/global/qtypeinfo.h +++ b/src/corelib/global/qtypeinfo.h @@ -19,6 +19,8 @@ class QDebug; QTypeInfo - type trait functionality */ +namespace QtPrivate { + template <typename T> inline constexpr bool qIsRelocatable = std::is_trivially_copyable_v<T> && std::is_trivially_destructible_v<T>; @@ -32,6 +34,8 @@ template <typename T> inline constexpr bool qIsValueInitializationBitwiseZero = std::is_scalar_v<T> && !std::is_member_object_pointer_v<T>; +} + /* The catch-all template. */ @@ -44,8 +48,8 @@ public: isPointer = std::is_pointer_v<T>, isIntegral = std::is_integral_v<T>, isComplex = !std::is_trivial_v<T>, - isRelocatable = qIsRelocatable<T>, - isValueInitializationBitwiseZero = qIsValueInitializationBitwiseZero<T>, + isRelocatable = QtPrivate::qIsRelocatable<T>, + isValueInitializationBitwiseZero = QtPrivate::qIsValueInitializationBitwiseZero<T>, }; }; @@ -148,10 +152,10 @@ class QTypeInfo<TYPE > \ public: \ enum { \ isComplex = (((FLAGS) & Q_PRIMITIVE_TYPE) == 0) && !std::is_trivial_v<TYPE>, \ - isRelocatable = !isComplex || ((FLAGS) & Q_RELOCATABLE_TYPE) || qIsRelocatable<TYPE>, \ + isRelocatable = !isComplex || ((FLAGS) & Q_RELOCATABLE_TYPE) || QtPrivate::qIsRelocatable<TYPE>, \ isPointer = std::is_pointer_v< TYPE >, \ isIntegral = std::is_integral< TYPE >::value, \ - isValueInitializationBitwiseZero = qIsValueInitializationBitwiseZero<TYPE>, \ + isValueInitializationBitwiseZero = QtPrivate::qIsValueInitializationBitwiseZero<TYPE>, \ }; \ } diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h index 844ad3cd65..50b8dc24fb 100644 --- a/src/corelib/kernel/qvariant.h +++ b/src/corelib/kernel/qvariant.h @@ -51,7 +51,7 @@ class QVariant; template<typename T> inline T qvariant_cast(const QVariant &); -template<> constexpr inline bool qIsRelocatable<QVariant> = true; +template<> constexpr inline bool QtPrivate::qIsRelocatable<QVariant> = true; class Q_CORE_EXPORT QVariant { struct CborValueStandIn { qint64 n; void *c; int t; }; |