From ed7f77071dcca996a8c8147fd66344090666e60c Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 5 Aug 2016 10:12:12 +0200 Subject: Replace custom type traits with std one's Remove most type traits from qtypetraits.h, but keep the custom implementation of is_signed/is_unsigned. This gets rid of BSD-3 licensed code from Google in a public header (hugh!). The custom implementations for is_signed/is_unsigned are kept because the implementations in gcc's standard headers do not work as we expect for enums - both is_signed and is_unsigned always returns false there - see also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59027 [ChangeLog][QtCore][General] Qt now relies on type traits from the C++ standard library. Change-Id: I3f2188b46949f04ca4482a6ac9afd3482103f0e1 Reviewed-by: Thiago Macieira --- src/corelib/kernel/qvariant_p.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/corelib/kernel/qvariant_p.h') diff --git a/src/corelib/kernel/qvariant_p.h b/src/corelib/kernel/qvariant_p.h index d01f386032..ec87e20656 100644 --- a/src/corelib/kernel/qvariant_p.h +++ b/src/corelib/kernel/qvariant_p.h @@ -66,7 +66,7 @@ struct QVariantIntegrator { static const bool CanUseInternalSpace = sizeof(T) <= sizeof(QVariant::Private::Data) && ((QTypeInfoQuery::isRelocatable) || Q_IS_ENUM(T)); - typedef QtPrivate::integral_constant CanUseInternalSpace_t; + typedef std::integral_constant CanUseInternalSpace_t; }; Q_STATIC_ASSERT(QVariantIntegrator::CanUseInternalSpace); Q_STATIC_ASSERT(QVariantIntegrator::CanUseInternalSpace); @@ -118,28 +118,28 @@ private: }; template -inline void v_construct_helper(QVariant::Private *x, const T &t, QtPrivate::true_type) +inline void v_construct_helper(QVariant::Private *x, const T &t, std::true_type) { new (&x->data) T(t); x->is_shared = false; } template -inline void v_construct_helper(QVariant::Private *x, const T &t, QtPrivate::false_type) +inline void v_construct_helper(QVariant::Private *x, const T &t, std::false_type) { x->data.shared = new QVariantPrivateSharedEx(t); x->is_shared = true; } template -inline void v_construct_helper(QVariant::Private *x, QtPrivate::true_type) +inline void v_construct_helper(QVariant::Private *x, std::true_type) { new (&x->data) T(); x->is_shared = false; } template -inline void v_construct_helper(QVariant::Private *x, QtPrivate::false_type) +inline void v_construct_helper(QVariant::Private *x, std::false_type) { x->data.shared = new QVariantPrivateSharedEx; x->is_shared = true; -- cgit v1.2.3 From 5c3b16706ff30c38258df0e98e071bf8ae6a1460 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 8 Aug 2016 09:05:53 +0200 Subject: Remove compiler-specific implementations of Q_IS_ENUM Since the macro is now just a wrapper for std::is_enum, its use is also deprecated. [ChangeLog][QtCore][Global] Q_IS_ENUM is deprecated. Use std::is_enum<>::value instead. Change-Id: I09b9f4559c02c81f338cace927873318f2acafde Reviewed-by: Thiago Macieira --- src/corelib/kernel/qvariant_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/kernel/qvariant_p.h') diff --git a/src/corelib/kernel/qvariant_p.h b/src/corelib/kernel/qvariant_p.h index ec87e20656..bf88def438 100644 --- a/src/corelib/kernel/qvariant_p.h +++ b/src/corelib/kernel/qvariant_p.h @@ -65,7 +65,7 @@ template struct QVariantIntegrator { static const bool CanUseInternalSpace = sizeof(T) <= sizeof(QVariant::Private::Data) - && ((QTypeInfoQuery::isRelocatable) || Q_IS_ENUM(T)); + && ((QTypeInfoQuery::isRelocatable) || std::is_enum::value); typedef std::integral_constant CanUseInternalSpace_t; }; Q_STATIC_ASSERT(QVariantIntegrator::CanUseInternalSpace); -- cgit v1.2.3