diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-09-21 11:52:30 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-09-22 08:34:55 +0200 |
commit | aeadc5c4741a63304579904b11dd60b349ba8e0c (patch) | |
tree | 557410858c6bf1a965d5773bebf67aee49e65643 | |
parent | c31e3af73e5b58f69438a6afa3fb3d73676c7cd7 (diff) |
Replace QmlVoidT with std::void_t
Now that we can use C++17 we don't need to invent our own.
Change-Id: I6c6e02ac9b48f2fbe88160e7f9ebf9655092c9fc
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
-rw-r--r-- | src/qml/qml/qqmlprivate.h | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/qml/qml/qqmlprivate.h b/src/qml/qml/qqmlprivate.h index 39bea42df6..e0de749fb3 100644 --- a/src/qml/qml/qqmlprivate.h +++ b/src/qml/qml/qqmlprivate.h @@ -228,9 +228,6 @@ namespace QQmlPrivate } }; - template<typename...> - using QmlVoidT = void; - // You can prevent subclasses from using the same attached type by specialzing this. // This is reserved for internal types, though. template<class T, class A> @@ -239,7 +236,7 @@ namespace QQmlPrivate using Type = A; }; - template<class T, class = QmlVoidT<>, bool OldStyle = QQmlTypeInfo<T>::hasAttachedProperties> + template<class T, class = std::void_t<>, bool OldStyle = QQmlTypeInfo<T>::hasAttachedProperties> struct QmlAttached { using Type = void; @@ -250,7 +247,7 @@ namespace QQmlPrivate // Defined inline via QML_ATTACHED template<class T> - struct QmlAttached<T, QmlVoidT<typename OverridableAttachedType<T, typename T::QmlAttachedType>::Type>, false> + struct QmlAttached<T, std::void_t<typename OverridableAttachedType<T, typename T::QmlAttachedType>::Type>, false> { // Normal attached properties template <typename Parent, typename Attached> @@ -286,7 +283,7 @@ namespace QQmlPrivate // Separately defined via QQmlTypeInfo template<class T> - struct QmlAttached<T, QmlVoidT<decltype(T::qmlAttachedProperties)>, true> + struct QmlAttached<T, std::void_t<decltype(T::qmlAttachedProperties)>, true> { using Type = typename std::remove_pointer<decltype(T::qmlAttachedProperties(nullptr))>::type; using Func = QQmlAttachedPropertiesFunc<Type>; @@ -545,50 +542,50 @@ namespace QQmlPrivate return elementName; } - template<class T, class = QmlVoidT<>> + template<class T, class = std::void_t<>> struct QmlExtended { using Type = void; }; template<class T> - struct QmlExtended<T, QmlVoidT<typename T::QmlExtendedType>> + struct QmlExtended<T, std::void_t<typename T::QmlExtendedType>> { using Type = typename T::QmlExtendedType; }; - template<class T, class = QmlVoidT<>> + template<class T, class = std::void_t<>> struct QmlResolved { using Type = T; }; template<class T> - struct QmlResolved<T, QmlVoidT<decltype(T::QmlForeignType::staticMetaObject)>> + struct QmlResolved<T, std::void_t<decltype(T::QmlForeignType::staticMetaObject)>> { using Type = typename T::QmlForeignType; }; - template<class T, class = QmlVoidT<>> + template<class T, class = std::void_t<>> struct QmlSingleton { static constexpr bool Value = false; }; template<class T> - struct QmlSingleton<T, QmlVoidT<typename T::QmlIsSingleton>> + struct QmlSingleton<T, std::void_t<typename T::QmlIsSingleton>> { static constexpr bool Value = bool(T::QmlIsSingleton::yes); }; - template<class T, class = QmlVoidT<>> + template<class T, class = std::void_t<>> struct QmlInterface { static constexpr bool Value = false; }; template<class T> - struct QmlInterface<T, QmlVoidT<typename T::QmlIsInterface>> + struct QmlInterface<T, std::void_t<typename T::QmlIsInterface>> { static constexpr bool Value = bool(T::QmlIsInterface::yes); }; |