diff --git a/src/corelib/global/qflags.h b/src/corelib/global/qflags.h index a6bd37c33f..f85fc705b4 100644 --- a/src/corelib/global/qflags.h +++ b/src/corelib/global/qflags.h @@ -102,7 +102,7 @@ public: // the definition below is too complex for qdoc typedef int Int; #else - typedef typename QtPrivate::if_< + typedef typename std::conditional< QtPrivate::is_unsigned::value, unsigned int, signed int diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 1bcd30e0b3..99be82f8c3 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -42,6 +42,7 @@ #define QGLOBAL_H #ifdef __cplusplus +# include # include #endif @@ -963,7 +964,7 @@ public: // - if there was a break inside the inner loop, it will exit with control still // set to 1; in that case, the outer loop will invert it to 0 and will exit too #define Q_FOREACH(variable, container) \ -for (QForeachContainer::type> _container_((container)); \ +for (QForeachContainer::type> _container_((container)); \ _container_.control && _container_.i != _container_.e; \ ++_container_.i, _container_.control ^= 1) \ for (variable = *_container_.i; _container_.control; _container_.control = 0) diff --git a/src/corelib/global/qisenum.h b/src/corelib/global/qisenum.h index 0a4d44619c..185db5e45f 100644 --- a/src/corelib/global/qisenum.h +++ b/src/corelib/global/qisenum.h @@ -55,8 +55,7 @@ #endif #ifndef Q_IS_ENUM -# include -# define Q_IS_ENUM(x) QtPrivate::is_enum::value +# define Q_IS_ENUM(x) std::is_enum::value #endif // shut up syncqt diff --git a/src/corelib/global/qnumeric_p.h b/src/corelib/global/qnumeric_p.h index ef40a45dc4..23fcf340f1 100644 --- a/src/corelib/global/qnumeric_p.h +++ b/src/corelib/global/qnumeric_p.h @@ -172,7 +172,7 @@ static inline bool qt_is_finite(float f) // Unsigned overflow math // namespace { -template inline typename QtPrivate::QEnableIf::value, bool>::Type +template inline typename QtPrivate::QEnableIf::value, bool>::Type add_overflow(T v1, T v2, T *r) { // unsigned additions are well-defined @@ -180,7 +180,7 @@ add_overflow(T v1, T v2, T *r) return v1 > T(v1 + v2); } -template inline typename QtPrivate::QEnableIf::value, bool>::Type +template inline typename QtPrivate::QEnableIf::value, bool>::Type mul_overflow(T v1, T v2, T *r) { // use the next biggest type diff --git a/src/corelib/global/qtypeinfo.h b/src/corelib/global/qtypeinfo.h index e709050011..cdc85ab1d0 100644 --- a/src/corelib/global/qtypeinfo.h +++ b/src/corelib/global/qtypeinfo.h @@ -38,12 +38,13 @@ ** ****************************************************************************/ -#include #include #ifndef QTYPEINFO_H #define QTYPEINFO_H +#include + QT_BEGIN_NAMESPACE /* @@ -60,7 +61,7 @@ class QTypeInfo public: enum { isPointer = false, - isIntegral = QtPrivate::is_integral::value, + isIntegral = std::is_integral::value, isComplex = true, isStatic = true, isRelocatable = Q_IS_ENUM(T), @@ -247,7 +248,7 @@ public: \ isRelocatable = !isStatic || ((FLAGS) & Q_RELOCATABLE_TYPE), \ isLarge = (sizeof(TYPE)>sizeof(void*)), \ isPointer = false, \ - isIntegral = QtPrivate::is_integral< TYPE >::value, \ + isIntegral = std::is_integral< TYPE >::value, \ isDummy = (((FLAGS) & Q_DUMMY_TYPE) != 0), \ sizeOf = sizeof(TYPE) \ }; \ diff --git a/src/corelib/global/qtypetraits.h b/src/corelib/global/qtypetraits.h index c311303e27..b664dd3a3e 100644 --- a/src/corelib/global/qtypetraits.h +++ b/src/corelib/global/qtypetraits.h @@ -37,451 +37,28 @@ ** ****************************************************************************/ -// BEGIN Google Code - -// Copyright (c) 2006, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// ---- -// -// This code is compiled directly on many platforms, including client -// platforms like Windows, Mac, and embedded systems. Before making -// any changes here, make sure that you're not breaking any platforms. -// -// Define a small subset of tr1 type traits. The traits we define are: -// is_integral -// is_floating_point -// is_pointer -// is_enum -// is_reference -// is_const -// is_volatile -// is_pod -// has_trivial_constructor -// has_trivial_copy -// has_trivial_assign -// has_trivial_destructor -// is_signed -// is_unsigned -// remove_const -// remove_volatile -// remove_cv -// remove_reference -// add_reference -// remove_pointer -// is_same -// is_convertible -// We can add more type traits as required. - -// Changes from the original implementation: -// - Move base types from template_util.h directly into this header. -// - Use Qt macros for long long type differences on Windows. -// - Enclose in QtPrivate namespace. - #include "QtCore/qglobal.h" #ifndef QTYPETRAITS_H #define QTYPETRAITS_H -#include // For pair - QT_BEGIN_NAMESPACE namespace QtPrivate { -// Types small_ and big_ are guaranteed such that sizeof(small_) < -// sizeof(big_) -typedef char small_; - -struct big_ { - char dummy[2]; -}; - -// Identity metafunction. -template -struct identity_ { - typedef T type; -}; - -// integral_constant, defined in tr1, is a wrapper for an integer -// value. We don't really need this generality; we could get away -// with hardcoding the integer type to bool. We use the fully -// general integer_constant for compatibility with tr1. - -template -struct integral_constant { - static const T value = v; - typedef T value_type; - typedef integral_constant type; -}; - -template const T integral_constant::value; - - -// Abbreviations: true_type and false_type are structs that represent boolean -// true and false values. Also define the boost::mpl versions of those names, -// true_ and false_. -typedef integral_constant true_type; -typedef integral_constant false_type; -typedef true_type true_; -typedef false_type false_; - -// if_ is a templatized conditional statement. -// if_ is a compile time evaluation of cond. -// if_<>::type contains A if cond is true, B otherwise. -template -struct if_{ - typedef A type; -}; - -template -struct if_ { - typedef B type; -}; - - -// type_equals_ is a template type comparator, similar to Loki IsSameType. -// type_equals_::value is true iff "A" is the same type as "B". // -// New code should prefer base::is_same, defined in base/type_traits.h. -// It is functionally identical, but is_same is the standard spelling. -template -struct type_equals_ : public false_ { -}; - -template -struct type_equals_ : public true_ { -}; - -// and_ is a template && operator. -// and_::value evaluates "A::value && B::value". -template -struct and_ : public integral_constant { -}; - -// or_ is a template || operator. -// or_::value evaluates "A::value || B::value". -template -struct or_ : public integral_constant { -}; - -template struct is_integral; -template struct is_floating_point; -template struct is_pointer; -// MSVC can't compile this correctly, and neither can gcc 3.3.5 (at least) -#if !defined(_MSC_VER) && !(defined(__GNUC__) && __GNUC__ <= 3) -// is_enum uses is_convertible, which is not available on MSVC. -template struct is_enum; -#endif -template struct is_reference; -template struct is_pod; -template struct has_trivial_constructor; -template struct has_trivial_copy; -template struct has_trivial_assign; -template struct has_trivial_destructor; -template struct remove_const; -template struct remove_volatile; -template struct remove_cv; -template struct remove_reference; -template struct add_reference; -template struct remove_pointer; -template struct is_same; -#if !defined(_MSC_VER) && !(defined(__GNUC__) && __GNUC__ <= 3) -template struct is_convertible; -#endif - -// is_integral is false except for the built-in integer types. A -// cv-qualified type is integral if and only if the underlying type is. -template struct is_integral : false_type { }; -template<> struct is_integral : true_type { }; -template<> struct is_integral : true_type { }; -template<> struct is_integral : true_type { }; -template<> struct is_integral : true_type { }; -#if defined(_MSC_VER) -// wchar_t is not by default a distinct type from unsigned short in -// Microsoft C. -// See http://msdn2.microsoft.com/en-us/library/dh8che7s(VS.80).aspx -template<> struct is_integral<__wchar_t> : true_type { }; -#else -template<> struct is_integral : true_type { }; -#endif -template<> struct is_integral : true_type { }; -template<> struct is_integral : true_type { }; -template<> struct is_integral : true_type { }; -template<> struct is_integral : true_type { }; -template<> struct is_integral : true_type { }; -template<> struct is_integral : true_type { }; -#if defined(Q_OS_WIN) && !defined(Q_CC_GNU) -template<> struct is_integral<__int64> : true_type { }; -template<> struct is_integral : true_type { }; -#else -template<> struct is_integral : true_type { }; -template<> struct is_integral : true_type { }; -#endif -template struct is_integral : is_integral { }; -template struct is_integral : is_integral { }; -template struct is_integral : is_integral { }; -#if defined (Q_COMPILER_UNICODE_STRINGS) -template<> struct is_integral : true_type { }; -template<> struct is_integral : true_type { }; -#endif - -// is_floating_point is false except for the built-in floating-point types. -// A cv-qualified type is integral if and only if the underlying type is. -template struct is_floating_point : false_type { }; -template<> struct is_floating_point : true_type { }; -template<> struct is_floating_point : true_type { }; -template<> struct is_floating_point : true_type { }; -template struct is_floating_point - : is_floating_point { }; -template struct is_floating_point - : is_floating_point { }; -template struct is_floating_point - : is_floating_point { }; - -// is_pointer is false except for pointer types. A cv-qualified type (e.g. -// "int* const", as opposed to "int const*") is cv-qualified if and only if -// the underlying type is. -template struct is_pointer : false_type { }; -template struct is_pointer : true_type { }; -template struct is_pointer : is_pointer { }; -template struct is_pointer : is_pointer { }; -template struct is_pointer : is_pointer { }; - -#if !defined(_MSC_VER) && !(defined(__GNUC__) && __GNUC__ <= 3) - -namespace internal { - -template struct is_class_or_union { - template static small_ tester(void (U::*)()); - template static big_ tester(...); - static const bool value = sizeof(tester(0)) == sizeof(small_); -}; - -// is_convertible chokes if the first argument is an array. That's why -// we use add_reference here. -template struct is_enum_impl - : is_convertible::type, int> { }; - -template struct is_enum_impl : false_type { }; - -} // namespace internal - -// Specified by TR1 [4.5.1] primary type categories. - -// Implementation note: +// define custom is_signed, is_unsigned that also works with enum's // -// Each type is either void, integral, floating point, array, pointer, -// reference, member object pointer, member function pointer, enum, -// union or class. Out of these, only integral, floating point, reference, -// class and enum types are potentially convertible to int. Therefore, -// if a type is not a reference, integral, floating point or class and -// is convertible to int, it's a enum. Adding cv-qualification to a type -// does not change whether it's an enum. -// -// Is-convertible-to-int check is done only if all other checks pass, -// because it can't be used with some types (e.g. void or classes with -// inaccessible conversion operators). -template struct is_enum - : internal::is_enum_impl< - is_same::value || - is_integral::value || - is_floating_point::value || - is_reference::value || - internal::is_class_or_union::value, - T> { }; - -template struct is_enum : is_enum { }; -template struct is_enum : is_enum { }; -template struct is_enum : is_enum { }; - -#endif - -// is_reference is false except for reference types. -template struct is_reference : false_type {}; -template struct is_reference : true_type {}; - -// Specified by TR1 [4.5.3] Type Properties -template struct is_const : false_type {}; -template struct is_const : true_type {}; -template struct is_volatile : false_type {}; -template struct is_volatile : true_type {}; - -// We can't get is_pod right without compiler help, so fail conservatively. -// We will assume it's false except for arithmetic types, enumerations, -// pointers and cv-qualified versions thereof. Note that std::pair -// is not a POD even if T and U are PODs. -template struct is_pod - : integral_constant::value || - is_floating_point::value || -#if !defined(_MSC_VER) && !(defined(__GNUC__) && __GNUC__ <= 3) - // is_enum is not available on MSVC. - is_enum::value || -#endif - is_pointer::value)> { }; -template struct is_pod : is_pod { }; -template struct is_pod : is_pod { }; -template struct is_pod : is_pod { }; - - -// We can't get has_trivial_constructor right without compiler help, so -// fail conservatively. We will assume it's false except for: (1) types -// for which is_pod is true. (2) std::pair of types with trivial -// constructors. (3) array of a type with a trivial constructor. -// (4) const versions thereof. -template struct has_trivial_constructor : is_pod { }; -template struct has_trivial_constructor > - : integral_constant::value && - has_trivial_constructor::value)> { }; -template struct has_trivial_constructor - : has_trivial_constructor { }; -template struct has_trivial_constructor - : has_trivial_constructor { }; - -// We can't get has_trivial_copy right without compiler help, so fail -// conservatively. We will assume it's false except for: (1) types -// for which is_pod is true. (2) std::pair of types with trivial copy -// constructors. (3) array of a type with a trivial copy constructor. -// (4) const versions thereof. -template struct has_trivial_copy : is_pod { }; -template struct has_trivial_copy > - : integral_constant::value && - has_trivial_copy::value)> { }; -template struct has_trivial_copy - : has_trivial_copy { }; -template struct has_trivial_copy : has_trivial_copy { }; - -// We can't get has_trivial_assign right without compiler help, so fail -// conservatively. We will assume it's false except for: (1) types -// for which is_pod is true. (2) std::pair of types with trivial copy -// constructors. (3) array of a type with a trivial assign constructor. -template struct has_trivial_assign : is_pod { }; -template struct has_trivial_assign > - : integral_constant::value && - has_trivial_assign::value)> { }; -template struct has_trivial_assign - : has_trivial_assign { }; - -// We can't get has_trivial_destructor right without compiler help, so -// fail conservatively. We will assume it's false except for: (1) types -// for which is_pod is true. (2) std::pair of types with trivial -// destructors. (3) array of a type with a trivial destructor. -// (4) const versions thereof. -template struct has_trivial_destructor : is_pod { }; -template struct has_trivial_destructor > - : integral_constant::value && - has_trivial_destructor::value)> { }; -template struct has_trivial_destructor - : has_trivial_destructor { }; -template struct has_trivial_destructor - : has_trivial_destructor { }; - -// Specified by TR1 [4.7.1] -template struct remove_const { typedef T type; }; -template struct remove_const { typedef T type; }; -template struct remove_volatile { typedef T type; }; -template struct remove_volatile { typedef T type; }; -template struct remove_cv { - typedef typename remove_const::type>::type type; -}; - - -// Specified by TR1 [4.7.2] Reference modifications. -template struct remove_reference { typedef T type; }; -template struct remove_reference { typedef T type; }; - -template struct add_reference { typedef T& type; }; -template struct add_reference { typedef T& type; }; - -// Specified by TR1 [4.7.4] Pointer modifications. -template struct remove_pointer { typedef T type; }; -template struct remove_pointer { typedef T type; }; -template struct remove_pointer { typedef T type; }; -template struct remove_pointer { typedef T type; }; -template struct remove_pointer { - typedef T type; }; - -// Specified by TR1 [4.6] Relationships between types -template struct is_same : public false_type { }; -template struct is_same : public true_type { }; - -// Specified by TR1 [4.6] Relationships between types -#if !defined(_MSC_VER) && !(defined(__GNUC__) && __GNUC__ <= 3) -namespace internal { - -// This class is an implementation detail for is_convertible, and you -// don't need to know how it works to use is_convertible. For those -// who care: we declare two different functions, one whose argument is -// of type To and one with a variadic argument list. We give them -// return types of different size, so we can use sizeof to trick the -// compiler into telling us which function it would have chosen if we -// had called it with an argument of type From. See Alexandrescu's -// _Modern C++ Design_ for more details on this sort of trick. - -template -struct ConvertHelper { - static small_ Test(To); - static big_ Test(...); - static From Create(); -}; -} // namespace internal - -// Inherits from true_type if From is convertible to To, false_type otherwise. -template -struct is_convertible - : integral_constant::Test( - internal::ConvertHelper::Create())) - == sizeof(small_)> { -}; -#endif - -// END Google Code // a metafunction to invert an integral_constant: template struct not_ - : integral_constant {}; - -// same, with a bool argument: -template -struct not_c - : integral_constant {}; + : std::integral_constant {}; // Checks whether a type is unsigned (T must be convertible to unsigned int): template struct is_unsigned - : integral_constant {}; + : std::integral_constant {}; // Checks whether a type is signed (T must be convertible to int): template @@ -512,27 +89,6 @@ Q_STATIC_ASSERT((!is_unsigned::value)); Q_STATIC_ASSERT((!is_signed::value)); Q_STATIC_ASSERT(( is_signed::value)); -template struct is_default_constructible; - -template<> struct is_default_constructible -{ -protected: - template struct test { typedef char type; }; -public: - static bool const value = false; -}; -template<> struct is_default_constructible<>::test { typedef double type; }; - -template struct is_default_constructible : is_default_constructible<> -{ -private: - template static typename test::type sfinae(U*); - template static char sfinae(...); -public: - static bool const value = sizeof(sfinae(0)) > 1; -}; - - } // namespace QtPrivate QT_END_NAMESPACE diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index 9e2a5bf75d..29e60b0eb5 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -46,7 +46,6 @@ #include #include #include -#include #ifndef QT_NO_QOBJECT #include #endif @@ -887,7 +886,7 @@ private: // is void* to avoid overloads conflicts. We do it by injecting unaccessible Dummy // type as part of the overload signature. struct Dummy {}; - typedef typename QtPrivate::if_::value, Dummy, value_type>::type value_type_OR_Dummy; + typedef typename std::conditional::value, Dummy, value_type>::type value_type_OR_Dummy; public: static void assign(void **ptr, const value_type_OR_Dummy *iterator ) { @@ -1092,7 +1091,7 @@ struct QSequentialIterableConvertFunctor } namespace QtMetaTypePrivate { -template::value> +template::value> struct AssociativeContainerAccessor { static const typename T::key_type& getKey(const typename T::const_iterator &it) @@ -1106,7 +1105,7 @@ struct AssociativeContainerAccessor } }; -template >::value> +template >::value> struct StlStyleAssociativeContainerAccessor; template @@ -1787,7 +1786,7 @@ template struct QMetaTypeIdQObject { enum { - Defined = QtPrivate::is_default_constructible::value + Defined = std::is_default_constructible::value }; static int qt_metatype_id() diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h index 3cec9802dc..69b70ad6ec 100644 --- a/src/corelib/kernel/qobject.h +++ b/src/corelib/kernel/qobject.h @@ -155,14 +155,14 @@ public: template inline T findChild(const QString &aName = QString(), Qt::FindChildOptions options = Qt::FindChildrenRecursively) const { - typedef typename QtPrivate::remove_cv::type>::type ObjType; + typedef typename std::remove_cv::type>::type ObjType; return static_cast(qt_qFindChild_helper(this, aName, ObjType::staticMetaObject, options)); } template inline QList findChildren(const QString &aName = QString(), Qt::FindChildOptions options = Qt::FindChildrenRecursively) const { - typedef typename QtPrivate::remove_cv::type>::type ObjType; + typedef typename std::remove_cv::type>::type ObjType; QList list; qt_qFindChildren_helper(this, aName, ObjType::staticMetaObject, reinterpret_cast *>(&list), options); @@ -173,7 +173,7 @@ public: template inline QList findChildren(const QRegExp &re, Qt::FindChildOptions options = Qt::FindChildrenRecursively) const { - typedef typename QtPrivate::remove_cv::type>::type ObjType; + typedef typename std::remove_cv::type>::type ObjType; QList list; qt_qFindChildren_helper(this, re, ObjType::staticMetaObject, reinterpret_cast *>(&list), options); @@ -185,7 +185,7 @@ public: template inline QList findChildren(const QRegularExpression &re, Qt::FindChildOptions options = Qt::FindChildrenRecursively) const { - typedef typename QtPrivate::remove_cv::type>::type ObjType; + typedef typename std::remove_cv::type>::type ObjType; QList list; qt_qFindChildren_helper(this, re, ObjType::staticMetaObject, reinterpret_cast *>(&list), options); @@ -493,7 +493,7 @@ inline QT_DEPRECATED QList qFindChildren(const QObject *o, const QRegExp &re) template inline T qobject_cast(QObject *object) { - typedef typename QtPrivate::remove_cv::type>::type ObjType; + typedef typename std::remove_cv::type>::type ObjType; Q_STATIC_ASSERT_X(QtPrivate::HasQ_OBJECT_Macro::Value, "qobject_cast requires the type to have a Q_OBJECT macro"); return static_cast(ObjType::staticMetaObject.cast(object)); @@ -502,7 +502,7 @@ inline T qobject_cast(QObject *object) template inline T qobject_cast(const QObject *object) { - typedef typename QtPrivate::remove_cv::type>::type ObjType; + typedef typename std::remove_cv::type>::type ObjType; Q_STATIC_ASSERT_X(QtPrivate::HasQ_OBJECT_Macro::Value, "qobject_cast requires the type to have a Q_OBJECT macro"); return static_cast(ObjType::staticMetaObject.cast(object)); diff --git a/src/corelib/kernel/qpointer.h b/src/corelib/kernel/qpointer.h index b5c17ad394..b2b3cda4ab 100644 --- a/src/corelib/kernel/qpointer.h +++ b/src/corelib/kernel/qpointer.h @@ -52,7 +52,7 @@ class QVariant; template class QPointer { - Q_STATIC_ASSERT_X(!QtPrivate::is_pointer::value, "QPointer's template type must not be a pointer type"); + Q_STATIC_ASSERT_X(!std::is_pointer::value, "QPointer's template type must not be a pointer type"); template struct TypeSelector diff --git a/src/corelib/kernel/qtimer.h b/src/corelib/kernel/qtimer.h index 4f934d0367..96c7efd8f5 100644 --- a/src/corelib/kernel/qtimer.h +++ b/src/corelib/kernel/qtimer.h @@ -119,14 +119,14 @@ public: // singleShot to a functor or function pointer (without context) template static inline typename QtPrivate::QEnableIf::IsPointerToMemberFunction && - !QtPrivate::is_same::value, void>::Type + !std::is_same::value, void>::Type singleShot(Duration interval, Func1 slot) { singleShot(interval, defaultTypeFor(interval), nullptr, slot); } template static inline typename QtPrivate::QEnableIf::IsPointerToMemberFunction && - !QtPrivate::is_same::value, void>::Type + !std::is_same::value, void>::Type singleShot(Duration interval, Qt::TimerType timerType, Func1 slot) { singleShot(interval, timerType, nullptr, slot); @@ -134,14 +134,14 @@ public: // singleShot to a functor or function pointer (with context) template static inline typename QtPrivate::QEnableIf::IsPointerToMemberFunction && - !QtPrivate::is_same::value, void>::Type + !std::is_same::value, void>::Type singleShot(Duration interval, QObject *context, Func1 slot) { singleShot(interval, defaultTypeFor(interval), context, slot); } template static inline typename QtPrivate::QEnableIf::IsPointerToMemberFunction && - !QtPrivate::is_same::value, void>::Type + !std::is_same::value, void>::Type singleShot(Duration interval, Qt::TimerType timerType, QObject *context, Func1 slot) { //compilation error if the slot has arguments. 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; diff --git a/src/corelib/thread/qmutex.cpp b/src/corelib/thread/qmutex.cpp index 366413e82e..6e0fa4eedb 100644 --- a/src/corelib/thread/qmutex.cpp +++ b/src/corelib/thread/qmutex.cpp @@ -48,7 +48,6 @@ #include "qelapsedtimer.h" #include "qthread.h" #include "qmutex_p.h" -#include "qtypetraits.h" #ifndef QT_LINUX_FUTEX #include "private/qfreelist_p.h" @@ -77,7 +76,7 @@ public: // written to by the thread that first owns 'mutex'; // read during attempts to acquire ownership of 'mutex' from any other thread: - QAtomicPointer::type> owner; + QAtomicPointer::type> owner; // only ever accessed from the thread that owns 'mutex': uint count; diff --git a/src/corelib/tools/qbytearray_p.h b/src/corelib/tools/qbytearray_p.h index 0824611d99..6ebff739cd 100644 --- a/src/corelib/tools/qbytearray_p.h +++ b/src/corelib/tools/qbytearray_p.h @@ -52,14 +52,13 @@ // #include -#include #include "qtools_p.h" QT_BEGIN_NAMESPACE enum { // Define as enum to force inlining. Don't expose MaxAllocSize in a public header. - MaxByteArraySize = MaxAllocSize - sizeof(QtPrivate::remove_pointer::type) + MaxByteArraySize = MaxAllocSize - sizeof(std::remove_pointer::type) }; QT_END_NAMESPACE diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index 6a2d7bdd11..d58c3c5733 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -764,7 +764,7 @@ Q_INLINE_TEMPLATE typename QHash::iterator QHash::insert(const K return iterator(createNode(h, akey, avalue, node)); } - if (!QtPrivate::is_same::value) + if (!std::is_same::value) (*node)->value = avalue; return iterator(*node); } diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index c7f27abdd6..c0a92aaa10 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -125,10 +125,10 @@ class QList { public: struct MemoryLayout - : QtPrivate::if_< + : std::conditional< QTypeInfo::isStatic || QTypeInfo::isLarge, QListData::IndirectLayout, - typename QtPrivate::if_< + typename std::conditional< sizeof(T) == sizeof(void*), QListData::ArrayCompatibleLayout, QListData::InlineWithPaddingLayout diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h index baa10b7a95..96ce787446 100644 --- a/src/corelib/tools/qmap.h +++ b/src/corelib/tools/qmap.h @@ -44,7 +44,6 @@ #include #include #include -#include #ifdef Q_MAP_DEBUG #include @@ -130,15 +129,15 @@ struct QMapNode : public QMapNodeBase { callDestructorIfNecessary(key); callDestructorIfNecessary(value); - doDestroySubTree(QtPrivate::integral_constant::isComplex || QTypeInfo::isComplex>()); + doDestroySubTree(std::integral_constant::isComplex || QTypeInfo::isComplex>()); } QMapNode *lowerBound(const Key &key); QMapNode *upperBound(const Key &key); private: - void doDestroySubTree(QtPrivate::false_type) {} - void doDestroySubTree(QtPrivate::true_type) + void doDestroySubTree(std::false_type) {} + void doDestroySubTree(std::true_type) { if (left) leftNode()->destroySubTree(); diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index a0c22c9179..5738413bfb 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -464,7 +464,7 @@ private: template inline void enableSharedFromThis(const QEnableSharedFromThis *ptr) { - ptr->initializeFromSharedPointer(constCast::type>()); + ptr->initializeFromSharedPointer(constCast::type>()); } inline void enableSharedFromThis(...) {} diff --git a/src/corelib/tools/qstringalgorithms_p.h b/src/corelib/tools/qstringalgorithms_p.h index d7127517e0..c5470bc7ad 100644 --- a/src/corelib/tools/qstringalgorithms_p.h +++ b/src/corelib/tools/qstringalgorithms_p.h @@ -60,8 +60,8 @@ template struct QStringAlgorithms { typedef typename StringType::value_type Char; typedef typename StringType::size_type size_type; - typedef typename QtPrivate::remove_cv::type NakedStringType; - static const bool isConst = QtPrivate::is_const::value; + typedef typename std::remove_cv::type NakedStringType; + static const bool isConst = std::is_const::value; static inline bool isSpace(char ch) { return ascii_isspace(ch); } static inline bool isSpace(QChar ch) { return ch.isSpace(); } diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h index 045431fcaf..c3ccfc3f8c 100644 --- a/src/testlib/qtestcase.h +++ b/src/testlib/qtestcase.h @@ -46,7 +46,6 @@ #include #include #include -#include #include #include @@ -312,7 +311,7 @@ namespace QTest template inline void addColumn(const char *name, T * = 0) { - typedef QtPrivate::is_same QIsSameTConstChar; + typedef std::is_same QIsSameTConstChar; Q_STATIC_ASSERT_X(!QIsSameTConstChar::value, "const char* is not allowed as a test data format."); addColumnInternal(qMetaTypeId(), name); } diff --git a/src/widgets/graphicsview/qgraphicsitem.h b/src/widgets/graphicsview/qgraphicsitem.h index 59656f5b0b..36f8aac124 100644 --- a/src/widgets/graphicsview/qgraphicsitem.h +++ b/src/widgets/graphicsview/qgraphicsitem.h @@ -1024,14 +1024,14 @@ private: template inline T qgraphicsitem_cast(QGraphicsItem *item) { - typedef typename QtPrivate::remove_cv::type>::type Item; + typedef typename std::remove_cv::type>::type Item; return int(Item::Type) == int(QGraphicsItem::Type) || (item && int(Item::Type) == item->type()) ? static_cast(item) : 0; } template inline T qgraphicsitem_cast(const QGraphicsItem *item) { - typedef typename QtPrivate::remove_cv::type>::type Item; + typedef typename std::remove_cv::type>::type Item; return int(Item::Type) == int(QGraphicsItem::Type) || (item && int(Item::Type) == item->type()) ? static_cast(item) : 0; } diff --git a/src/widgets/styles/qstyleoption.h b/src/widgets/styles/qstyleoption.h index 9679411402..0e76d53eea 100644 --- a/src/widgets/styles/qstyleoption.h +++ b/src/widgets/styles/qstyleoption.h @@ -665,7 +665,7 @@ protected: template T qstyleoption_cast(const QStyleOption *opt) { - typedef typename QtPrivate::remove_cv::type>::type Opt; + typedef typename std::remove_cv::type>::type Opt; if (opt && opt->version >= Opt::Version && (opt->type == Opt::Type || int(Opt::Type) == QStyleOption::SO_Default || (int(Opt::Type) == QStyleOption::SO_Complex @@ -677,7 +677,7 @@ T qstyleoption_cast(const QStyleOption *opt) template T qstyleoption_cast(QStyleOption *opt) { - typedef typename QtPrivate::remove_cv::type>::type Opt; + typedef typename std::remove_cv::type>::type Opt; if (opt && opt->version >= Opt::Version && (opt->type == Opt::Type || int(Opt::Type) == QStyleOption::SO_Default || (int(Opt::Type) == QStyleOption::SO_Complex @@ -728,7 +728,7 @@ public: template T qstyleoption_cast(const QStyleHintReturn *hint) { - typedef typename QtPrivate::remove_cv::type>::type Opt; + typedef typename std::remove_cv::type>::type Opt; if (hint && hint->version <= Opt::Version && (hint->type == Opt::Type || int(Opt::Type) == QStyleHintReturn::SH_Default)) return static_cast(hint); @@ -738,7 +738,7 @@ T qstyleoption_cast(const QStyleHintReturn *hint) template T qstyleoption_cast(QStyleHintReturn *hint) { - typedef typename QtPrivate::remove_cv::type>::type Opt; + typedef typename std::remove_cv::type>::type Opt; if (hint && hint->version <= Opt::Version && (hint->type == Opt::Type || int(Opt::Type) == QStyleHintReturn::SH_Default)) return static_cast(hint); diff --git a/src/widgets/widgets/qmenu.h b/src/widgets/widgets/qmenu.h index bcbd0a95c4..5d218ac1ba 100644 --- a/src/widgets/widgets/qmenu.h +++ b/src/widgets/widgets/qmenu.h @@ -98,7 +98,7 @@ public: #else // addAction(QString): Connect to a QObject slot / functor or function pointer (with context) template - inline typename QtPrivate::QEnableIf::value + inline typename QtPrivate::QEnableIf::value && QtPrivate::IsPointerToTypeDerivedFromQObject::Value, QAction *>::Type addAction(const QString &text, const Obj *object, Func1 slot, const QKeySequence &shortcut = 0) { @@ -126,7 +126,7 @@ public: } // addAction(QIcon, QString): Connect to a QObject slot / functor or function pointer (with context) template - inline typename QtPrivate::QEnableIf::value + inline typename QtPrivate::QEnableIf::value && QtPrivate::IsPointerToTypeDerivedFromQObject::Value, QAction *>::Type addAction(const QIcon &actionIcon, const QString &text, const Obj *object, Func1 slot, const QKeySequence &shortcut = 0) { diff --git a/src/widgets/widgets/qtoolbar.h b/src/widgets/widgets/qtoolbar.h index d361513bbf..0ea4d4afeb 100644 --- a/src/widgets/widgets/qtoolbar.h +++ b/src/widgets/widgets/qtoolbar.h @@ -116,7 +116,7 @@ public: #else // addAction(QString): Connect to a QObject slot / functor or function pointer (with context) template - inline typename QtPrivate::QEnableIf::value + inline typename QtPrivate::QEnableIf::value && QtPrivate::IsPointerToTypeDerivedFromQObject::Value, QAction *>::Type addAction(const QString &text, const Obj *object, Func1 slot) { @@ -134,7 +134,7 @@ public: } // addAction(QString): Connect to a QObject slot / functor or function pointer (with context) template - inline typename QtPrivate::QEnableIf::value + inline typename QtPrivate::QEnableIf::value && QtPrivate::IsPointerToTypeDerivedFromQObject::Value, QAction *>::Type addAction(const QIcon &actionIcon, const QString &text, const Obj *object, Func1 slot) { diff --git a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp index 9b92a4ff15..ff0497b69e 100644 --- a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp +++ b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp @@ -28,7 +28,6 @@ #include -#include #include #include @@ -376,8 +375,8 @@ void tst_QGlobal::isEnum() #define IS_ENUM_TRUE(x) (Q_IS_ENUM(x) == true) #define IS_ENUM_FALSE(x) (Q_IS_ENUM(x) == false) #else -#define IS_ENUM_TRUE(x) (Q_IS_ENUM(x) == true && QtPrivate::is_enum::value == true) -#define IS_ENUM_FALSE(x) (Q_IS_ENUM(x) == false && QtPrivate::is_enum::value == false) +#define IS_ENUM_TRUE(x) (Q_IS_ENUM(x) == true && std::is_enum::value == true) +#define IS_ENUM_FALSE(x) (Q_IS_ENUM(x) == false && std::is_enum::value == false) #endif QVERIFY(IS_ENUM_TRUE(isEnum_B_Byte)); diff --git a/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp b/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp index 1a70ac5e75..0c890eafbc 100644 --- a/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp +++ b/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp @@ -29,7 +29,6 @@ #include #include -#include #include #include @@ -197,7 +196,7 @@ void tst_QHashFunctions::range() { // verify that the input iterator category suffices: std::stringstream sstream; - Q_STATIC_ASSERT((QtPrivate::is_same::iterator_category>::value)); + Q_STATIC_ASSERT((std::is_same::iterator_category>::value)); std::copy(ints, ints + numInts, std::ostream_iterator(sstream, " ")); sstream.seekg(0); std::istream_iterator it(sstream), end;