Get rid of QEnableIf

Use std::enable_if instead.

Change-Id: I02a2f3066f9e4cab6db1909681a17330afdbbedb
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Lars Knoll 2020-09-08 13:51:14 +02:00
parent 05acc167c9
commit 6751933521
2 changed files with 3 additions and 9 deletions

View File

@ -1233,12 +1233,6 @@ inline int qIntCast(float f) { return int(f); }
"Compile your code with -fPIC (and not with -fPIE)."
#endif
namespace QtPrivate {
//like std::enable_if
template <bool B, typename T = void> struct QEnableIf;
template <typename T> struct QEnableIf<true, T> { typedef T Type; };
}
#define QT_VA_ARGS_CHOOSE(_1, _2, _3, _4, _5, _6, _7, _8, _9, N, ...) N
#define QT_VA_ARGS_EXPAND(...) __VA_ARGS__ // Needed for MSVC
#define QT_VA_ARGS_COUNT(...) QT_VA_ARGS_EXPAND(QT_VA_ARGS_CHOOSE(__VA_ARGS__, 9, 8, 7, 6, 5, 4, 3, 2, 1))

View File

@ -194,7 +194,7 @@ namespace {
namespace GetFileTimes {
#if !QT_CONFIG(futimens) && (QT_CONFIG(futimes))
template <typename T>
static inline typename QtPrivate::QEnableIf<(&T::st_atim, &T::st_mtim, true)>::Type get(const T *p, struct timeval *access, struct timeval *modification)
static inline typename std::enable_if_t<(&T::st_atim, &T::st_mtim, true)> get(const T *p, struct timeval *access, struct timeval *modification)
{
access->tv_sec = p->st_atim.tv_sec;
access->tv_usec = p->st_atim.tv_nsec / 1000;
@ -204,7 +204,7 @@ static inline typename QtPrivate::QEnableIf<(&T::st_atim, &T::st_mtim, true)>::T
}
template <typename T>
static inline typename QtPrivate::QEnableIf<(&T::st_atimespec, &T::st_mtimespec, true)>::Type get(const T *p, struct timeval *access, struct timeval *modification)
static inline typename std::enable_if_t<(&T::st_atimespec, &T::st_mtimespec, true)> get(const T *p, struct timeval *access, struct timeval *modification)
{
access->tv_sec = p->st_atimespec.tv_sec;
access->tv_usec = p->st_atimespec.tv_nsec / 1000;
@ -216,7 +216,7 @@ static inline typename QtPrivate::QEnableIf<(&T::st_atimespec, &T::st_mtimespec,
# ifndef st_atimensec
// if "st_atimensec" is defined, this would expand to invalid C++
template <typename T>
static inline typename QtPrivate::QEnableIf<(&T::st_atimensec, &T::st_mtimensec, true)>::Type get(const T *p, struct timeval *access, struct timeval *modification)
static inline typename std::enable_if_t<(&T::st_atimensec, &T::st_mtimensec, true)> get(const T *p, struct timeval *access, struct timeval *modification)
{
access->tv_sec = p->st_atime;
access->tv_usec = p->st_atimensec / 1000;