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>
This commit is contained in:
parent
42612b0180
commit
e64eaf57f3
@ -19,6 +19,8 @@ class QDebug;
|
|||||||
QTypeInfo - type trait functionality
|
QTypeInfo - type trait functionality
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace QtPrivate {
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline constexpr bool qIsRelocatable = std::is_trivially_copyable_v<T> && std::is_trivially_destructible_v<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 =
|
inline constexpr bool qIsValueInitializationBitwiseZero =
|
||||||
std::is_scalar_v<T> && !std::is_member_object_pointer_v<T>;
|
std::is_scalar_v<T> && !std::is_member_object_pointer_v<T>;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
The catch-all template.
|
The catch-all template.
|
||||||
*/
|
*/
|
||||||
@ -44,8 +48,8 @@ public:
|
|||||||
isPointer = std::is_pointer_v<T>,
|
isPointer = std::is_pointer_v<T>,
|
||||||
isIntegral = std::is_integral_v<T>,
|
isIntegral = std::is_integral_v<T>,
|
||||||
isComplex = !std::is_trivial_v<T>,
|
isComplex = !std::is_trivial_v<T>,
|
||||||
isRelocatable = qIsRelocatable<T>,
|
isRelocatable = QtPrivate::qIsRelocatable<T>,
|
||||||
isValueInitializationBitwiseZero = qIsValueInitializationBitwiseZero<T>,
|
isValueInitializationBitwiseZero = QtPrivate::qIsValueInitializationBitwiseZero<T>,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -148,10 +152,10 @@ class QTypeInfo<TYPE > \
|
|||||||
public: \
|
public: \
|
||||||
enum { \
|
enum { \
|
||||||
isComplex = (((FLAGS) & Q_PRIMITIVE_TYPE) == 0) && !std::is_trivial_v<TYPE>, \
|
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 >, \
|
isPointer = std::is_pointer_v< TYPE >, \
|
||||||
isIntegral = std::is_integral< TYPE >::value, \
|
isIntegral = std::is_integral< TYPE >::value, \
|
||||||
isValueInitializationBitwiseZero = qIsValueInitializationBitwiseZero<TYPE>, \
|
isValueInitializationBitwiseZero = QtPrivate::qIsValueInitializationBitwiseZero<TYPE>, \
|
||||||
}; \
|
}; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ class QVariant;
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
inline T qvariant_cast(const QVariant &);
|
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
|
class Q_CORE_EXPORT QVariant
|
||||||
{
|
{
|
||||||
struct CborValueStandIn { qint64 n; void *c; int t; };
|
struct CborValueStandIn { qint64 n; void *c; int t; };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user