Use std::enable_if instead of QEnableIf
Change-Id: Ideca8283141484cb6da47c50333f5c96e416f082 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This commit is contained in:
parent
d03ba0e895
commit
30d0e1770c
@ -101,7 +101,7 @@ QFuture<T> run(T (*functionPointer)(Param1, Param2, Param3, Param4, Param5), con
|
||||
#if defined(Q_COMPILER_DECLTYPE) && defined(Q_COMPILER_AUTO_FUNCTION)
|
||||
|
||||
template <typename Functor>
|
||||
auto run(Functor functor) -> typename QtPrivate::QEnableIf<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor())> >::Type
|
||||
auto run(Functor functor) -> typename std::enable_if<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor())>>::type
|
||||
{
|
||||
typedef decltype(functor()) result_type;
|
||||
return (new StoredFunctorCall0<result_type, Functor>(functor))->start();
|
||||
@ -109,7 +109,7 @@ auto run(Functor functor) -> typename QtPrivate::QEnableIf<!QtPrivate::HasResult
|
||||
|
||||
template <typename Functor, typename Arg1>
|
||||
auto run(Functor functor, const Arg1 &arg1)
|
||||
-> typename QtPrivate::QEnableIf<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor(arg1))> >::Type
|
||||
-> typename std::enable_if<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor(arg1))>>::type
|
||||
{
|
||||
typedef decltype(functor(arg1)) result_type;
|
||||
return (new StoredFunctorCall1<result_type, Functor, Arg1>(functor, arg1))->start();
|
||||
@ -117,7 +117,7 @@ auto run(Functor functor, const Arg1 &arg1)
|
||||
|
||||
template <typename Functor, typename Arg1, typename Arg2>
|
||||
auto run(Functor functor, const Arg1 &arg1, const Arg2 &arg2)
|
||||
-> typename QtPrivate::QEnableIf<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor(arg1, arg2))> >::Type
|
||||
-> typename std::enable_if<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor(arg1, arg2))>>::type
|
||||
{
|
||||
typedef decltype(functor(arg1, arg2)) result_type;
|
||||
return (new StoredFunctorCall2<result_type, Functor, Arg1, Arg2>(functor, arg1, arg2))->start();
|
||||
@ -125,7 +125,7 @@ auto run(Functor functor, const Arg1 &arg1, const Arg2 &arg2)
|
||||
|
||||
template <typename Functor, typename Arg1, typename Arg2, typename Arg3>
|
||||
auto run(Functor functor, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3)
|
||||
-> typename QtPrivate::QEnableIf<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor(arg1, arg2, arg3))> >::Type
|
||||
-> typename std::enable_if<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor(arg1, arg2, arg3))>>::type
|
||||
{
|
||||
typedef decltype(functor(arg1, arg2, arg3)) result_type;
|
||||
return (new StoredFunctorCall3<result_type, Functor, Arg1, Arg2, Arg3>(functor, arg1, arg2, arg3))->start();
|
||||
@ -133,7 +133,7 @@ auto run(Functor functor, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3)
|
||||
|
||||
template <typename Functor, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
|
||||
auto run(Functor functor, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4)
|
||||
-> typename QtPrivate::QEnableIf<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor(arg1, arg2, arg3, arg4))> >::Type
|
||||
-> typename std::enable_if<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor(arg1, arg2, arg3, arg4))>>::type
|
||||
{
|
||||
typedef decltype(functor(arg1, arg2, arg3, arg4)) result_type;
|
||||
return (new StoredFunctorCall4<result_type, Functor, Arg1, Arg2, Arg3, Arg4>(functor, arg1, arg2, arg3, arg4))->start();
|
||||
@ -141,7 +141,7 @@ auto run(Functor functor, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3,
|
||||
|
||||
template <typename Functor, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5>
|
||||
auto run(Functor functor, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5)
|
||||
-> typename QtPrivate::QEnableIf<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor(arg1, arg2, arg3, arg4, arg5))> >::Type
|
||||
-> typename std::enable_if<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor(arg1, arg2, arg3, arg4, arg5))>>::type
|
||||
{
|
||||
typedef decltype(functor(arg1, arg2, arg3, arg4, arg5)) result_type;
|
||||
return (new StoredFunctorCall5<result_type, Functor, Arg1, Arg2, Arg3, Arg4, Arg5>(functor, arg1, arg2, arg3, arg4, arg5))->start();
|
||||
@ -372,7 +372,7 @@ QFuture<T> run(QThreadPool *pool, T (*functionPointer)(Param1, Param2, Param3, P
|
||||
#if defined(Q_COMPILER_DECLTYPE) && defined(Q_COMPILER_AUTO_FUNCTION)
|
||||
|
||||
template <typename Functor>
|
||||
auto run(QThreadPool *pool, Functor functor) -> typename QtPrivate::QEnableIf<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor())> >::Type
|
||||
auto run(QThreadPool *pool, Functor functor) -> typename std::enable_if<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor())>>::type
|
||||
{
|
||||
typedef decltype(functor()) result_type;
|
||||
return (new StoredFunctorCall0<result_type, Functor>(functor))->start(pool);
|
||||
@ -380,7 +380,7 @@ auto run(QThreadPool *pool, Functor functor) -> typename QtPrivate::QEnableIf<!Q
|
||||
|
||||
template <typename Functor, typename Arg1>
|
||||
auto run(QThreadPool *pool, Functor functor, const Arg1 &arg1)
|
||||
-> typename QtPrivate::QEnableIf<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor(arg1))> >::Type
|
||||
-> typename std::enable_if<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor(arg1))>>::type
|
||||
{
|
||||
typedef decltype(functor(arg1)) result_type;
|
||||
return (new StoredFunctorCall1<result_type, Functor, Arg1>(functor, arg1))->start(pool);
|
||||
@ -388,7 +388,7 @@ auto run(QThreadPool *pool, Functor functor, const Arg1 &arg1)
|
||||
|
||||
template <typename Functor, typename Arg1, typename Arg2>
|
||||
auto run(QThreadPool *pool, Functor functor, const Arg1 &arg1, const Arg2 &arg2)
|
||||
-> typename QtPrivate::QEnableIf<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor(arg1, arg2))> >::Type
|
||||
-> typename std::enable_if<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor(arg1, arg2))>>::type
|
||||
{
|
||||
typedef decltype(functor(arg1, arg2)) result_type;
|
||||
return (new StoredFunctorCall2<result_type, Functor, Arg1, Arg2>(functor, arg1, arg2))->start(pool);
|
||||
@ -396,7 +396,7 @@ auto run(QThreadPool *pool, Functor functor, const Arg1 &arg1, const Arg2 &arg2)
|
||||
|
||||
template <typename Functor, typename Arg1, typename Arg2, typename Arg3>
|
||||
auto run(QThreadPool *pool, Functor functor, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3)
|
||||
-> typename QtPrivate::QEnableIf<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor(arg1, arg2, arg3))> >::Type
|
||||
-> typename std::enable_if<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor(arg1, arg2, arg3))>>::type
|
||||
{
|
||||
typedef decltype(functor(arg1, arg2, arg3)) result_type;
|
||||
return (new StoredFunctorCall3<result_type, Functor, Arg1, Arg2, Arg3>(functor, arg1, arg2, arg3))->start(pool);
|
||||
@ -404,7 +404,7 @@ auto run(QThreadPool *pool, Functor functor, const Arg1 &arg1, const Arg2 &arg2,
|
||||
|
||||
template <typename Functor, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
|
||||
auto run(QThreadPool *pool, Functor functor, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4)
|
||||
-> typename QtPrivate::QEnableIf<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor(arg1, arg2, arg3, arg4))> >::Type
|
||||
-> typename std::enable_if<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor(arg1, arg2, arg3, arg4))>>::type
|
||||
{
|
||||
typedef decltype(functor(arg1, arg2, arg3, arg4)) result_type;
|
||||
return (new StoredFunctorCall4<result_type, Functor, Arg1, Arg2, Arg3, Arg4>(functor, arg1, arg2, arg3, arg4))->start(pool);
|
||||
@ -412,7 +412,7 @@ auto run(QThreadPool *pool, Functor functor, const Arg1 &arg1, const Arg2 &arg2,
|
||||
|
||||
template <typename Functor, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5>
|
||||
auto run(QThreadPool *pool, Functor functor, const Arg1 &arg1, const Arg2 &arg2, const Arg3 &arg3, const Arg4 &arg4, const Arg5 &arg5)
|
||||
-> typename QtPrivate::QEnableIf<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor(arg1, arg2, arg3, arg4, arg5))> >::Type
|
||||
-> typename std::enable_if<!QtPrivate::HasResultType<Functor>::Value, QFuture<decltype(functor(arg1, arg2, arg3, arg4, arg5))>>::type
|
||||
{
|
||||
typedef decltype(functor(arg1, arg2, arg3, arg4, arg5)) result_type;
|
||||
return (new StoredFunctorCall5<result_type, Functor, Arg1, Arg2, Arg3, Arg4, Arg5>(functor, arg1, arg2, arg3, arg4, arg5))->start(pool);
|
||||
|
@ -174,7 +174,7 @@ static inline bool qt_is_finite(float f)
|
||||
// Unsigned overflow math
|
||||
//
|
||||
namespace {
|
||||
template <typename T> inline typename QtPrivate::QEnableIf<std::is_unsigned<T>::value, bool>::Type
|
||||
template <typename T> inline typename std::enable_if<std::is_unsigned<T>::value, bool>::type
|
||||
add_overflow(T v1, T v2, T *r)
|
||||
{
|
||||
// unsigned additions are well-defined
|
||||
@ -182,7 +182,7 @@ add_overflow(T v1, T v2, T *r)
|
||||
return v1 > T(v1 + v2);
|
||||
}
|
||||
|
||||
template <typename T> inline typename QtPrivate::QEnableIf<std::is_unsigned<T>::value, bool>::Type
|
||||
template <typename T> inline typename std::enable_if<std::is_unsigned<T>::value, bool>::type
|
||||
mul_overflow(T v1, T v2, T *r)
|
||||
{
|
||||
// use the next biggest type
|
||||
|
@ -124,7 +124,7 @@ struct QTypeInfoQuery : public QTypeInfo<T>
|
||||
|
||||
// if QTypeInfo<T>::isRelocatable exists, use it
|
||||
template <typename T>
|
||||
struct QTypeInfoQuery<T, typename QtPrivate::QEnableIf<QTypeInfo<T>::isRelocatable || true>::Type> : public QTypeInfo<T>
|
||||
struct QTypeInfoQuery<T, typename std::enable_if<QTypeInfo<T>::isRelocatable || true>::type> : public QTypeInfo<T>
|
||||
{};
|
||||
|
||||
/*!
|
||||
|
@ -365,7 +365,7 @@ Q_CORE_EXPORT QDebug qt_QMetaEnum_debugOperator(QDebug&, int value, const QMetaO
|
||||
Q_CORE_EXPORT QDebug qt_QMetaEnum_flagDebugOperator(QDebug &dbg, quint64 value, const QMetaObject *meta, const char *name);
|
||||
|
||||
template<typename T>
|
||||
typename QtPrivate::QEnableIf<QtPrivate::IsQEnumHelper<T>::Value, QDebug>::Type
|
||||
typename std::enable_if<QtPrivate::IsQEnumHelper<T>::Value, QDebug>::type
|
||||
operator<<(QDebug dbg, T value)
|
||||
{
|
||||
const QMetaObject *obj = qt_getEnumMetaObject(value);
|
||||
@ -374,9 +374,9 @@ operator<<(QDebug dbg, T value)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline typename QtPrivate::QEnableIf<
|
||||
inline typename std::enable_if<
|
||||
QtPrivate::IsQEnumHelper<T>::Value || QtPrivate::IsQEnumHelper<QFlags<T> >::Value,
|
||||
QDebug>::Type
|
||||
QDebug>::type
|
||||
qt_QMetaEnum_flagDebugOperator_helper(QDebug debug, const QFlags<T> &flags)
|
||||
{
|
||||
const QMetaObject *obj = qt_getEnumMetaObject(T());
|
||||
@ -385,9 +385,9 @@ qt_QMetaEnum_flagDebugOperator_helper(QDebug debug, const QFlags<T> &flags)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline typename QtPrivate::QEnableIf<
|
||||
inline typename std::enable_if<
|
||||
!QtPrivate::IsQEnumHelper<T>::Value && !QtPrivate::IsQEnumHelper<QFlags<T> >::Value,
|
||||
QDebug>::Type
|
||||
QDebug>::type
|
||||
qt_QMetaEnum_flagDebugOperator_helper(QDebug debug, const QFlags<T> &flags)
|
||||
#else // !QT_NO_QOBJECT && !Q_QDOC
|
||||
template <class T>
|
||||
@ -402,7 +402,7 @@ template<typename T>
|
||||
inline QDebug operator<<(QDebug debug, const QFlags<T> &flags)
|
||||
{
|
||||
// We have to use an indirection otherwise specialisation of some other overload of the
|
||||
// operator<< the compiler would try to instantiate QFlags<T> for the QEnableIf
|
||||
// operator<< the compiler would try to instantiate QFlags<T> for the std::enable_if
|
||||
return qt_QMetaEnum_flagDebugOperator_helper(debug, flags);
|
||||
}
|
||||
|
||||
|
@ -1413,17 +1413,17 @@ namespace QtPrivate
|
||||
static inline const QMetaObject *value() { return Q_NULLPTR; }
|
||||
};
|
||||
template<typename T>
|
||||
struct MetaObjectForType<T*, typename QEnableIf<IsPointerToTypeDerivedFromQObject<T*>::Value>::Type>
|
||||
struct MetaObjectForType<T*, typename std::enable_if<IsPointerToTypeDerivedFromQObject<T*>::Value>::type>
|
||||
{
|
||||
static inline const QMetaObject *value() { return &T::staticMetaObject; }
|
||||
};
|
||||
template<typename T>
|
||||
struct MetaObjectForType<T, typename QEnableIf<IsGadgetHelper<T>::Value>::Type>
|
||||
struct MetaObjectForType<T, typename std::enable_if<IsGadgetHelper<T>::Value>::type>
|
||||
{
|
||||
static inline const QMetaObject *value() { return &T::staticMetaObject; }
|
||||
};
|
||||
template<typename T>
|
||||
struct MetaObjectForType<T, typename QEnableIf<IsQEnumHelper<T>::Value>::Type >
|
||||
struct MetaObjectForType<T, typename std::enable_if<IsQEnumHelper<T>::Value>::type >
|
||||
{
|
||||
static inline const QMetaObject *value() { return qt_getEnumMetaObject(T()); }
|
||||
};
|
||||
@ -2009,7 +2009,7 @@ struct SharedPointerMetaTypeIdHelper<SMART_POINTER<T>, true> \
|
||||
}; \
|
||||
template<typename T> \
|
||||
struct MetaTypeSmartPointerHelper<SMART_POINTER<T> , \
|
||||
typename QEnableIf<IsPointerToTypeDerivedFromQObject<T*>::Value >::Type> \
|
||||
typename std::enable_if<IsPointerToTypeDerivedFromQObject<T*>::Value>::type> \
|
||||
{ \
|
||||
static bool registerConverter(int id) \
|
||||
{ \
|
||||
|
@ -261,7 +261,7 @@ public:
|
||||
|
||||
//connect to a function pointer (not a member)
|
||||
template <typename Func1, typename Func2>
|
||||
static inline typename QtPrivate::QEnableIf<int(QtPrivate::FunctionPointer<Func2>::ArgumentCount) >= 0, QMetaObject::Connection>::Type
|
||||
static inline typename std::enable_if<int(QtPrivate::FunctionPointer<Func2>::ArgumentCount) >= 0, QMetaObject::Connection>::type
|
||||
connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, Func2 slot)
|
||||
{
|
||||
return connect(sender, signal, sender, slot, Qt::DirectConnection);
|
||||
@ -269,8 +269,8 @@ public:
|
||||
|
||||
//connect to a function pointer (not a member)
|
||||
template <typename Func1, typename Func2>
|
||||
static inline typename QtPrivate::QEnableIf<int(QtPrivate::FunctionPointer<Func2>::ArgumentCount) >= 0 &&
|
||||
!QtPrivate::FunctionPointer<Func2>::IsPointerToMemberFunction, QMetaObject::Connection>::Type
|
||||
static inline typename std::enable_if<int(QtPrivate::FunctionPointer<Func2>::ArgumentCount) >= 0 &&
|
||||
!QtPrivate::FunctionPointer<Func2>::IsPointerToMemberFunction, QMetaObject::Connection>::type
|
||||
connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, const QObject *context, Func2 slot,
|
||||
Qt::ConnectionType type = Qt::AutoConnection)
|
||||
{
|
||||
@ -301,7 +301,7 @@ public:
|
||||
|
||||
//connect to a functor
|
||||
template <typename Func1, typename Func2>
|
||||
static inline typename QtPrivate::QEnableIf<QtPrivate::FunctionPointer<Func2>::ArgumentCount == -1, QMetaObject::Connection>::Type
|
||||
static inline typename std::enable_if<QtPrivate::FunctionPointer<Func2>::ArgumentCount == -1, QMetaObject::Connection>::type
|
||||
connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, Func2 slot)
|
||||
{
|
||||
return connect(sender, signal, sender, slot, Qt::DirectConnection);
|
||||
@ -309,7 +309,7 @@ public:
|
||||
|
||||
//connect to a functor, with a "context" object defining in which event loop is going to be executed
|
||||
template <typename Func1, typename Func2>
|
||||
static inline typename QtPrivate::QEnableIf<QtPrivate::FunctionPointer<Func2>::ArgumentCount == -1, QMetaObject::Connection>::Type
|
||||
static inline typename std::enable_if<QtPrivate::FunctionPointer<Func2>::ArgumentCount == -1, QMetaObject::Connection>::type
|
||||
connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, const QObject *context, Func2 slot,
|
||||
Qt::ConnectionType type = Qt::AutoConnection)
|
||||
{
|
||||
|
@ -118,30 +118,30 @@ public:
|
||||
}
|
||||
// singleShot to a functor or function pointer (without context)
|
||||
template <typename Duration, typename Func1>
|
||||
static inline typename QtPrivate::QEnableIf<!QtPrivate::FunctionPointer<Func1>::IsPointerToMemberFunction &&
|
||||
!std::is_same<const char*, Func1>::value, void>::Type
|
||||
static inline typename std::enable_if<!QtPrivate::FunctionPointer<Func1>::IsPointerToMemberFunction &&
|
||||
!std::is_same<const char*, Func1>::value, void>::type
|
||||
singleShot(Duration interval, Func1 slot)
|
||||
{
|
||||
singleShot(interval, defaultTypeFor(interval), nullptr, slot);
|
||||
}
|
||||
template <typename Duration, typename Func1>
|
||||
static inline typename QtPrivate::QEnableIf<!QtPrivate::FunctionPointer<Func1>::IsPointerToMemberFunction &&
|
||||
!std::is_same<const char*, Func1>::value, void>::Type
|
||||
static inline typename std::enable_if<!QtPrivate::FunctionPointer<Func1>::IsPointerToMemberFunction &&
|
||||
!std::is_same<const char*, Func1>::value, void>::type
|
||||
singleShot(Duration interval, Qt::TimerType timerType, Func1 slot)
|
||||
{
|
||||
singleShot(interval, timerType, nullptr, slot);
|
||||
}
|
||||
// singleShot to a functor or function pointer (with context)
|
||||
template <typename Duration, typename Func1>
|
||||
static inline typename QtPrivate::QEnableIf<!QtPrivate::FunctionPointer<Func1>::IsPointerToMemberFunction &&
|
||||
!std::is_same<const char*, Func1>::value, void>::Type
|
||||
static inline typename std::enable_if<!QtPrivate::FunctionPointer<Func1>::IsPointerToMemberFunction &&
|
||||
!std::is_same<const char*, Func1>::value, void>::type
|
||||
singleShot(Duration interval, QObject *context, Func1 slot)
|
||||
{
|
||||
singleShot(interval, defaultTypeFor(interval), context, slot);
|
||||
}
|
||||
template <typename Duration, typename Func1>
|
||||
static inline typename QtPrivate::QEnableIf<!QtPrivate::FunctionPointer<Func1>::IsPointerToMemberFunction &&
|
||||
!std::is_same<const char*, Func1>::value, void>::Type
|
||||
static inline typename std::enable_if<!QtPrivate::FunctionPointer<Func1>::IsPointerToMemberFunction &&
|
||||
!std::is_same<const char*, Func1>::value, void>::type
|
||||
singleShot(Duration interval, Qt::TimerType timerType, QObject *context, Func1 slot)
|
||||
{
|
||||
//compilation error if the slot has arguments.
|
||||
|
@ -283,7 +283,7 @@ template <typename BaseClass> struct QGenericAtomicOps
|
||||
}
|
||||
|
||||
template <typename T> static Q_ALWAYS_INLINE
|
||||
T fetchAndAndRelaxed(T &_q_value, typename QtPrivate::QEnableIf<QTypeInfo<T>::isIntegral, T>::Type operand) Q_DECL_NOTHROW
|
||||
T fetchAndAndRelaxed(T &_q_value, typename std::enable_if<QTypeInfo<T>::isIntegral, T>::type operand) Q_DECL_NOTHROW
|
||||
{
|
||||
// implement fetchAndAnd on top of testAndSet
|
||||
T tmp = BaseClass::load(_q_value);
|
||||
@ -294,7 +294,7 @@ template <typename BaseClass> struct QGenericAtomicOps
|
||||
}
|
||||
|
||||
template <typename T> static Q_ALWAYS_INLINE
|
||||
T fetchAndAndAcquire(T &_q_value, typename QtPrivate::QEnableIf<QTypeInfo<T>::isIntegral, T>::Type operand) Q_DECL_NOTHROW
|
||||
T fetchAndAndAcquire(T &_q_value, typename std::enable_if<QTypeInfo<T>::isIntegral, T>::type operand) Q_DECL_NOTHROW
|
||||
{
|
||||
T tmp = BaseClass::fetchAndAndRelaxed(_q_value, operand);
|
||||
BaseClass::acquireMemoryFence(_q_value);
|
||||
@ -302,21 +302,21 @@ template <typename BaseClass> struct QGenericAtomicOps
|
||||
}
|
||||
|
||||
template <typename T> static Q_ALWAYS_INLINE
|
||||
T fetchAndAndRelease(T &_q_value, typename QtPrivate::QEnableIf<QTypeInfo<T>::isIntegral, T>::Type operand) Q_DECL_NOTHROW
|
||||
T fetchAndAndRelease(T &_q_value, typename std::enable_if<QTypeInfo<T>::isIntegral, T>::type operand) Q_DECL_NOTHROW
|
||||
{
|
||||
BaseClass::releaseMemoryFence(_q_value);
|
||||
return BaseClass::fetchAndAndRelaxed(_q_value, operand);
|
||||
}
|
||||
|
||||
template <typename T> static Q_ALWAYS_INLINE
|
||||
T fetchAndAndOrdered(T &_q_value, typename QtPrivate::QEnableIf<QTypeInfo<T>::isIntegral, T>::Type operand) Q_DECL_NOTHROW
|
||||
T fetchAndAndOrdered(T &_q_value, typename std::enable_if<QTypeInfo<T>::isIntegral, T>::type operand) Q_DECL_NOTHROW
|
||||
{
|
||||
BaseClass::orderedMemoryFence(_q_value);
|
||||
return BaseClass::fetchAndAndRelaxed(_q_value, operand);
|
||||
}
|
||||
|
||||
template <typename T> static Q_ALWAYS_INLINE
|
||||
T fetchAndOrRelaxed(T &_q_value, typename QtPrivate::QEnableIf<QTypeInfo<T>::isIntegral, T>::Type operand) Q_DECL_NOTHROW
|
||||
T fetchAndOrRelaxed(T &_q_value, typename std::enable_if<QTypeInfo<T>::isIntegral, T>::type operand) Q_DECL_NOTHROW
|
||||
{
|
||||
// implement fetchAndOr on top of testAndSet
|
||||
T tmp = BaseClass::load(_q_value);
|
||||
@ -327,7 +327,7 @@ template <typename BaseClass> struct QGenericAtomicOps
|
||||
}
|
||||
|
||||
template <typename T> static Q_ALWAYS_INLINE
|
||||
T fetchAndOrAcquire(T &_q_value, typename QtPrivate::QEnableIf<QTypeInfo<T>::isIntegral, T>::Type operand) Q_DECL_NOTHROW
|
||||
T fetchAndOrAcquire(T &_q_value, typename std::enable_if<QTypeInfo<T>::isIntegral, T>::type operand) Q_DECL_NOTHROW
|
||||
{
|
||||
T tmp = BaseClass::fetchAndOrRelaxed(_q_value, operand);
|
||||
BaseClass::acquireMemoryFence(_q_value);
|
||||
@ -335,21 +335,21 @@ template <typename BaseClass> struct QGenericAtomicOps
|
||||
}
|
||||
|
||||
template <typename T> static Q_ALWAYS_INLINE
|
||||
T fetchAndOrRelease(T &_q_value, typename QtPrivate::QEnableIf<QTypeInfo<T>::isIntegral, T>::Type operand) Q_DECL_NOTHROW
|
||||
T fetchAndOrRelease(T &_q_value, typename std::enable_if<QTypeInfo<T>::isIntegral, T>::type operand) Q_DECL_NOTHROW
|
||||
{
|
||||
BaseClass::releaseMemoryFence(_q_value);
|
||||
return BaseClass::fetchAndOrRelaxed(_q_value, operand);
|
||||
}
|
||||
|
||||
template <typename T> static Q_ALWAYS_INLINE
|
||||
T fetchAndOrOrdered(T &_q_value, typename QtPrivate::QEnableIf<QTypeInfo<T>::isIntegral, T>::Type operand) Q_DECL_NOTHROW
|
||||
T fetchAndOrOrdered(T &_q_value, typename std::enable_if<QTypeInfo<T>::isIntegral, T>::type operand) Q_DECL_NOTHROW
|
||||
{
|
||||
BaseClass::orderedMemoryFence(_q_value);
|
||||
return BaseClass::fetchAndOrRelaxed(_q_value, operand);
|
||||
}
|
||||
|
||||
template <typename T> static Q_ALWAYS_INLINE
|
||||
T fetchAndXorRelaxed(T &_q_value, typename QtPrivate::QEnableIf<QTypeInfo<T>::isIntegral, T>::Type operand) Q_DECL_NOTHROW
|
||||
T fetchAndXorRelaxed(T &_q_value, typename std::enable_if<QTypeInfo<T>::isIntegral, T>::type operand) Q_DECL_NOTHROW
|
||||
{
|
||||
// implement fetchAndXor on top of testAndSet
|
||||
T tmp = BaseClass::load(_q_value);
|
||||
@ -360,7 +360,7 @@ template <typename BaseClass> struct QGenericAtomicOps
|
||||
}
|
||||
|
||||
template <typename T> static Q_ALWAYS_INLINE
|
||||
T fetchAndXorAcquire(T &_q_value, typename QtPrivate::QEnableIf<QTypeInfo<T>::isIntegral, T>::Type operand) Q_DECL_NOTHROW
|
||||
T fetchAndXorAcquire(T &_q_value, typename std::enable_if<QTypeInfo<T>::isIntegral, T>::type operand) Q_DECL_NOTHROW
|
||||
{
|
||||
T tmp = BaseClass::fetchAndXorRelaxed(_q_value, operand);
|
||||
BaseClass::acquireMemoryFence(_q_value);
|
||||
@ -368,14 +368,14 @@ template <typename BaseClass> struct QGenericAtomicOps
|
||||
}
|
||||
|
||||
template <typename T> static Q_ALWAYS_INLINE
|
||||
T fetchAndXorRelease(T &_q_value, typename QtPrivate::QEnableIf<QTypeInfo<T>::isIntegral, T>::Type operand) Q_DECL_NOTHROW
|
||||
T fetchAndXorRelease(T &_q_value, typename std::enable_if<QTypeInfo<T>::isIntegral, T>::type operand) Q_DECL_NOTHROW
|
||||
{
|
||||
BaseClass::releaseMemoryFence(_q_value);
|
||||
return BaseClass::fetchAndXorRelaxed(_q_value, operand);
|
||||
}
|
||||
|
||||
template <typename T> static Q_ALWAYS_INLINE
|
||||
T fetchAndXorOrdered(T &_q_value, typename QtPrivate::QEnableIf<QTypeInfo<T>::isIntegral, T>::Type operand) Q_DECL_NOTHROW
|
||||
T fetchAndXorOrdered(T &_q_value, typename std::enable_if<QTypeInfo<T>::isIntegral, T>::type operand) Q_DECL_NOTHROW
|
||||
{
|
||||
BaseClass::orderedMemoryFence(_q_value);
|
||||
return BaseClass::fetchAndXorRelaxed(_q_value, operand);
|
||||
|
@ -211,25 +211,25 @@ static void clear_thread_data()
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static typename QtPrivate::QEnableIf<QTypeInfo<T>::isIntegral, Qt::HANDLE>::Type to_HANDLE(T id)
|
||||
static typename std::enable_if<QTypeInfo<T>::isIntegral, Qt::HANDLE>::type to_HANDLE(T id)
|
||||
{
|
||||
return reinterpret_cast<Qt::HANDLE>(static_cast<intptr_t>(id));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static typename QtPrivate::QEnableIf<QTypeInfo<T>::isIntegral, T>::Type from_HANDLE(Qt::HANDLE id)
|
||||
static typename std::enable_if<QTypeInfo<T>::isIntegral, T>::type from_HANDLE(Qt::HANDLE id)
|
||||
{
|
||||
return static_cast<T>(reinterpret_cast<intptr_t>(id));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static typename QtPrivate::QEnableIf<QTypeInfo<T>::isPointer, Qt::HANDLE>::Type to_HANDLE(T id)
|
||||
static typename std::enable_if<QTypeInfo<T>::isPointer, Qt::HANDLE>::type to_HANDLE(T id)
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static typename QtPrivate::QEnableIf<QTypeInfo<T>::isPointer, T>::Type from_HANDLE(Qt::HANDLE id)
|
||||
static typename std::enable_if<QTypeInfo<T>::isPointer, T>::type from_HANDLE(Qt::HANDLE id)
|
||||
{
|
||||
return static_cast<T>(id);
|
||||
}
|
||||
|
@ -411,18 +411,18 @@ struct QArrayOpsSelector
|
||||
|
||||
template <class T>
|
||||
struct QArrayOpsSelector<T,
|
||||
typename QEnableIf<
|
||||
typename std::enable_if<
|
||||
!QTypeInfo<T>::isComplex && !QTypeInfo<T>::isStatic
|
||||
>::Type>
|
||||
>::type>
|
||||
{
|
||||
typedef QPodArrayOps<T> Type;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct QArrayOpsSelector<T,
|
||||
typename QEnableIf<
|
||||
typename std::enable_if<
|
||||
QTypeInfo<T>::isComplex && !QTypeInfo<T>::isStatic
|
||||
>::Type>
|
||||
>::type>
|
||||
{
|
||||
typedef QMovableArrayOps<T> Type;
|
||||
};
|
||||
|
@ -99,10 +99,10 @@ struct Q_CORE_EXPORT QMapNodeBase
|
||||
void setParent(QMapNodeBase *pp) { p = (p & Mask) | quintptr(pp); }
|
||||
|
||||
template <typename T>
|
||||
static typename QtPrivate::QEnableIf<QTypeInfo<T>::isComplex>::Type
|
||||
static typename std::enable_if<QTypeInfo<T>::isComplex>::type
|
||||
callDestructorIfNecessary(T &t) Q_DECL_NOTHROW { Q_UNUSED(t); t.~T(); } // Q_UNUSED: silence MSVC unused 't' warning
|
||||
template <typename T>
|
||||
static typename QtPrivate::QEnableIf<!QTypeInfo<T>::isComplex>::Type
|
||||
static typename std::enable_if<!QTypeInfo<T>::isComplex>::type
|
||||
callDestructorIfNecessary(T &) Q_DECL_NOTHROW {}
|
||||
};
|
||||
|
||||
|
@ -974,13 +974,13 @@ qobject_cast(const QWeakPointer<T> &src)
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
QWeakPointer<typename QtPrivate::QEnableIf<QtPrivate::IsPointerToTypeDerivedFromQObject<T*>::Value, T>::Type>
|
||||
QWeakPointer<typename std::enable_if<QtPrivate::IsPointerToTypeDerivedFromQObject<T*>::Value, T>::type>
|
||||
qWeakPointerFromVariant(const QVariant &variant)
|
||||
{
|
||||
return QWeakPointer<T>(qobject_cast<T*>(QtSharedPointer::weakPointerFromVariant_internal(variant).data()));
|
||||
}
|
||||
template<typename T>
|
||||
QSharedPointer<typename QtPrivate::QEnableIf<QtPrivate::IsPointerToTypeDerivedFromQObject<T*>::Value, T>::Type>
|
||||
QSharedPointer<typename std::enable_if<QtPrivate::IsPointerToTypeDerivedFromQObject<T*>::Value, T>::type>
|
||||
qSharedPointerFromVariant(const QVariant &variant)
|
||||
{
|
||||
return qSharedPointerObjectCast<T>(QtSharedPointer::sharedPointerFromVariant_internal(variant));
|
||||
|
@ -108,9 +108,9 @@ union qt_sockaddr {
|
||||
|
||||
namespace {
|
||||
namespace SetSALen {
|
||||
template <typename T> void set(T *sa, typename QtPrivate::QEnableIf<(&T::sa_len, true), QT_SOCKLEN_T>::Type len)
|
||||
template <typename T> void set(T *sa, typename std::enable_if<(&T::sa_len, true), QT_SOCKLEN_T>::type len)
|
||||
{ sa->sa_len = len; }
|
||||
template <typename T> void set(T *sin6, typename QtPrivate::QEnableIf<(&T::sin6_len, true), QT_SOCKLEN_T>::Type len)
|
||||
template <typename T> void set(T *sin6, typename std::enable_if<(&T::sin6_len, true), QT_SOCKLEN_T>::type len)
|
||||
{ sin6->sin6_len = len; }
|
||||
template <typename T> void set(T *, ...) {}
|
||||
}
|
||||
|
@ -240,14 +240,14 @@ namespace QTest
|
||||
namespace Internal {
|
||||
|
||||
template<typename T> // Output registered enums
|
||||
inline typename QtPrivate::QEnableIf<QtPrivate::IsQEnumHelper<T>::Value, char*>::Type toString(T e)
|
||||
inline typename std::enable_if<QtPrivate::IsQEnumHelper<T>::Value, char*>::type toString(T e)
|
||||
{
|
||||
QMetaEnum me = QMetaEnum::fromType<T>();
|
||||
return qstrdup(me.valueToKey(int(e))); // int cast is necessary to support enum classes
|
||||
}
|
||||
|
||||
template <typename T> // Fallback
|
||||
inline typename QtPrivate::QEnableIf<!QtPrivate::IsQEnumHelper<T>::Value, char*>::Type toString(const T &)
|
||||
inline typename std::enable_if<!QtPrivate::IsQEnumHelper<T>::Value, char*>::type toString(const T &)
|
||||
{
|
||||
return Q_NULLPTR;
|
||||
}
|
||||
|
@ -98,8 +98,8 @@ public:
|
||||
#else
|
||||
// addAction(QString): Connect to a QObject slot / functor or function pointer (with context)
|
||||
template<class Obj, typename Func1>
|
||||
inline typename QtPrivate::QEnableIf<!std::is_same<const char*, Func1>::value
|
||||
&& QtPrivate::IsPointerToTypeDerivedFromQObject<Obj*>::Value, QAction *>::Type
|
||||
inline typename std::enable_if<!std::is_same<const char*, Func1>::value
|
||||
&& QtPrivate::IsPointerToTypeDerivedFromQObject<Obj*>::Value, QAction *>::type
|
||||
addAction(const QString &text, const Obj *object, Func1 slot, const QKeySequence &shortcut = 0)
|
||||
{
|
||||
QAction *result = addAction(text);
|
||||
@ -126,8 +126,8 @@ public:
|
||||
}
|
||||
// addAction(QIcon, QString): Connect to a QObject slot / functor or function pointer (with context)
|
||||
template<class Obj, typename Func1>
|
||||
inline typename QtPrivate::QEnableIf<!std::is_same<const char*, Func1>::value
|
||||
&& QtPrivate::IsPointerToTypeDerivedFromQObject<Obj*>::Value, QAction *>::Type
|
||||
inline typename std::enable_if<!std::is_same<const char*, Func1>::value
|
||||
&& QtPrivate::IsPointerToTypeDerivedFromQObject<Obj*>::Value, QAction *>::type
|
||||
addAction(const QIcon &actionIcon, const QString &text, const Obj *object, Func1 slot, const QKeySequence &shortcut = 0)
|
||||
{
|
||||
QAction *result = addAction(actionIcon, text);
|
||||
|
@ -116,8 +116,8 @@ public:
|
||||
#else
|
||||
// addAction(QString): Connect to a QObject slot / functor or function pointer (with context)
|
||||
template<class Obj, typename Func1>
|
||||
inline typename QtPrivate::QEnableIf<!std::is_same<const char*, Func1>::value
|
||||
&& QtPrivate::IsPointerToTypeDerivedFromQObject<Obj*>::Value, QAction *>::Type
|
||||
inline typename std::enable_if<!std::is_same<const char*, Func1>::value
|
||||
&& QtPrivate::IsPointerToTypeDerivedFromQObject<Obj*>::Value, QAction *>::type
|
||||
addAction(const QString &text, const Obj *object, Func1 slot)
|
||||
{
|
||||
QAction *result = addAction(text);
|
||||
@ -134,8 +134,8 @@ public:
|
||||
}
|
||||
// addAction(QString): Connect to a QObject slot / functor or function pointer (with context)
|
||||
template<class Obj, typename Func1>
|
||||
inline typename QtPrivate::QEnableIf<!std::is_same<const char*, Func1>::value
|
||||
&& QtPrivate::IsPointerToTypeDerivedFromQObject<Obj*>::Value, QAction *>::Type
|
||||
inline typename std::enable_if<!std::is_same<const char*, Func1>::value
|
||||
&& QtPrivate::IsPointerToTypeDerivedFromQObject<Obj*>::Value, QAction *>::type
|
||||
addAction(const QIcon &actionIcon, const QString &text, const Obj *object, Func1 slot)
|
||||
{
|
||||
QAction *result = addAction(actionIcon, text);
|
||||
|
Loading…
Reference in New Issue
Block a user