From 40cd0f35ef0b27b1451caf393a97b8a4ac8cd4b2 Mon Sep 17 00:00:00 2001 From: Mikhail Svetkin Date: Tue, 28 Aug 2018 16:41:28 +0200 Subject: Remove QConditional in favor of std::conditional/std::is_unsigned Change-Id: I5e0b9f640eb49aa7f5afdd4f3f15e027659e78ea Reviewed-by: Edward Welbourne --- src/corelib/global/qglobal.h | 3 --- src/corelib/tools/qbytearray.cpp | 4 +--- src/corelib/tools/qlocale.cpp | 4 +--- src/corelib/tools/qmakearray_p.h | 4 ++-- src/corelib/tools/qoffsetstringarray_p.h | 8 ++++---- src/corelib/tools/qstring.h | 6 ++---- 6 files changed, 10 insertions(+), 19 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 75d9655ea1..f56629faa1 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1186,9 +1186,6 @@ namespace QtPrivate { //like std::enable_if template struct QEnableIf; template struct QEnableIf { typedef T Type; }; - -template struct QConditional { typedef T Type; }; -template struct QConditional { typedef F Type; }; } QT_END_NAMESPACE diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index 10e9b22161..d8aadaa744 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -3885,9 +3885,7 @@ static qulonglong toIntegral_helper(const char *data, bool *ok, int base, qulong template static inline T toIntegral_helper(const char *data, bool *ok, int base) { - // ### Qt6: use std::conditional::value, qulonglong, qlonglong>::type - const bool isUnsigned = T(0) < T(-1); - typedef typename QtPrivate::QConditional::Type Int64; + using Int64 = typename std::conditional::value, qulonglong, qlonglong>::type; #if defined(QT_CHECK_RANGE) if (base != 0 && (base < 2 || base > 36)) { diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index b285e58779..7425302857 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -1180,9 +1180,7 @@ static qulonglong toIntegral_helper(const QLocaleData *d, QStringView str, bool template static inline T toIntegral_helper(const QLocalePrivate *d, QStringView str, bool *ok) { - // ### Qt6: use std::conditional::value, qulonglong, qlonglong>::type - const bool isUnsigned = T(0) < T(-1); - typedef typename QtPrivate::QConditional::Type Int64; + using Int64 = typename std::conditional::value, qulonglong, qlonglong>::type; // we select the right overload by the last, unused parameter Int64 val = toIntegral_helper(d->m_data, str, ok, d->m_numberOptions, Int64()); diff --git a/src/corelib/tools/qmakearray_p.h b/src/corelib/tools/qmakearray_p.h index ae4d7f07c6..71441c2c27 100644 --- a/src/corelib/tools/qmakearray_p.h +++ b/src/corelib/tools/qmakearray_p.h @@ -111,10 +111,10 @@ struct QuickSortFilter> using TailFilteredData = typename QuickSortFilter< Predicate, QuickSortData>::Type; - using Type = typename QConditional< + using Type = typename std::conditional< Predicate::value, decltype(quickSortConcat(QuickSortData {}, TailFilteredData{})), - TailFilteredData>::Type; + TailFilteredData>::type; }; template