Remove QConditional in favor of std::conditional/std::is_unsigned
Change-Id: I5e0b9f640eb49aa7f5afdd4f3f15e027659e78ea Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>bb10
parent
dd944136a2
commit
40cd0f35ef
|
|
@ -1186,9 +1186,6 @@ namespace QtPrivate {
|
|||
//like std::enable_if
|
||||
template <bool B, typename T = void> struct QEnableIf;
|
||||
template <typename T> struct QEnableIf<true, T> { typedef T Type; };
|
||||
|
||||
template <bool B, typename T, typename F> struct QConditional { typedef T Type; };
|
||||
template <typename T, typename F> struct QConditional<false, T, F> { typedef F Type; };
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -3885,9 +3885,7 @@ static qulonglong toIntegral_helper(const char *data, bool *ok, int base, qulong
|
|||
template <typename T> static inline
|
||||
T toIntegral_helper(const char *data, bool *ok, int base)
|
||||
{
|
||||
// ### Qt6: use std::conditional<std::is_unsigned<T>::value, qulonglong, qlonglong>::type
|
||||
const bool isUnsigned = T(0) < T(-1);
|
||||
typedef typename QtPrivate::QConditional<isUnsigned, qulonglong, qlonglong>::Type Int64;
|
||||
using Int64 = typename std::conditional<std::is_unsigned<T>::value, qulonglong, qlonglong>::type;
|
||||
|
||||
#if defined(QT_CHECK_RANGE)
|
||||
if (base != 0 && (base < 2 || base > 36)) {
|
||||
|
|
|
|||
|
|
@ -1180,9 +1180,7 @@ static qulonglong toIntegral_helper(const QLocaleData *d, QStringView str, bool
|
|||
template <typename T> static inline
|
||||
T toIntegral_helper(const QLocalePrivate *d, QStringView str, bool *ok)
|
||||
{
|
||||
// ### Qt6: use std::conditional<std::is_unsigned<T>::value, qulonglong, qlonglong>::type
|
||||
const bool isUnsigned = T(0) < T(-1);
|
||||
typedef typename QtPrivate::QConditional<isUnsigned, qulonglong, qlonglong>::Type Int64;
|
||||
using Int64 = typename std::conditional<std::is_unsigned<T>::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());
|
||||
|
|
|
|||
|
|
@ -111,10 +111,10 @@ struct QuickSortFilter<Predicate, QuickSortData<Head, Tail...>>
|
|||
using TailFilteredData = typename QuickSortFilter<
|
||||
Predicate, QuickSortData<Tail...>>::Type;
|
||||
|
||||
using Type = typename QConditional<
|
||||
using Type = typename std::conditional<
|
||||
Predicate<Head>::value,
|
||||
decltype(quickSortConcat(QuickSortData<Head> {}, TailFilteredData{})),
|
||||
TailFilteredData>::Type;
|
||||
TailFilteredData>::type;
|
||||
};
|
||||
|
||||
template <template <typename> class Predicate>
|
||||
|
|
|
|||
|
|
@ -66,14 +66,14 @@ template<int Last, int I, int S, int ... Idx>
|
|||
struct OffsetSequenceHelper<1, Last, I, S, Idx...> : IndexesList<Last + I, Idx..., Last>
|
||||
{
|
||||
static const constexpr auto Length = Last + I;
|
||||
using Type = typename QConditional<
|
||||
using Type = typename std::conditional<
|
||||
Last <= std::numeric_limits<quint8>::max(),
|
||||
quint8,
|
||||
typename QConditional<
|
||||
typename std::conditional<
|
||||
Last <= std::numeric_limits<quint16>::max(),
|
||||
quint16,
|
||||
int>::Type
|
||||
>::Type;
|
||||
int>::type
|
||||
>::type;
|
||||
};
|
||||
|
||||
template<int ... Idx>
|
||||
|
|
|
|||
|
|
@ -896,10 +896,8 @@ private:
|
|||
template <typename T> static
|
||||
T toIntegral_helper(const QChar *data, int len, bool *ok, int base)
|
||||
{
|
||||
// ### Qt6: use std::conditional<std::is_unsigned<T>::value, qulonglong, qlonglong>::type
|
||||
const bool isUnsigned = T(0) < T(-1);
|
||||
typedef typename QtPrivate::QConditional<isUnsigned, qulonglong, qlonglong>::Type Int64;
|
||||
typedef typename QtPrivate::QConditional<isUnsigned, uint, int>::Type Int32;
|
||||
using Int64 = typename std::conditional<std::is_unsigned<T>::value, qulonglong, qlonglong>::type;
|
||||
using Int32 = typename std::conditional<std::is_unsigned<T>::value, uint, int>::type;
|
||||
|
||||
// we select the right overload by casting size() to int or uint
|
||||
Int64 val = toIntegral_helper(data, Int32(len), ok, base);
|
||||
|
|
|
|||
Loading…
Reference in New Issue