QMetaType: move is_complete template further up

Alongside the rest, makes the code better organized.

Pick-to: 6.4
Change-Id: I36b24183fbd041179f2ffffd17025ca7fe988a5a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
Thiago Macieira 2022-07-16 09:38:09 -07:00
parent 6b3c6155e9
commit 7211771c64

View File

@ -831,6 +831,20 @@ QT_FOR_EACH_AUTOMATIC_TEMPLATE_SMART_POINTER(QT_FORWARD_DECLARE_SHARED_POINTER_T
namespace QtPrivate
{
namespace detail {
template<typename T, typename ODR_VIOLATION_PREVENTER>
struct is_complete_helper
{
template<typename U>
static auto check(U *) -> std::integral_constant<bool, sizeof(U) != 0>;
static auto check(...) -> std::false_type;
using type = decltype(check(static_cast<T *>(nullptr)));
};
} // namespace detail
template <typename T, typename ODR_VIOLATION_PREVENTER>
struct is_complete : detail::is_complete_helper<T, ODR_VIOLATION_PREVENTER>::type {};
template<typename T>
struct IsPointerToTypeDerivedFromQObject
{
@ -2464,7 +2478,6 @@ QT_FOR_EACH_STATIC_CORE_POINTER(QT_METATYPE_DECLARE_EXTERN_TEMPLATE_ITER)
QT_FOR_EACH_STATIC_CORE_TEMPLATE(QT_METATYPE_DECLARE_EXTERN_TEMPLATE_ITER)
#undef QT_METATYPE_DECLARE_EXTERN_TEMPLATE_ITER
#endif
template<typename T>
constexpr const QMetaTypeInterface *qMetaTypeInterfaceForType()
{
@ -2472,20 +2485,6 @@ constexpr const QMetaTypeInterface *qMetaTypeInterfaceForType()
return &QMetaTypeInterfaceWrapper<Ty>::metaType;
}
namespace detail {
template<typename T, typename ODR_VIOLATION_PREVENTER>
struct is_complete_helper
{
template<typename U>
static auto check(U *) -> std::integral_constant<bool, sizeof(U) != 0>;
static auto check(...) -> std::false_type;
using type = decltype(check(static_cast<T *>(nullptr)));
};
} // namespace detail
template <typename T, typename ODR_VIOLATION_PREVENTER>
struct is_complete : detail::is_complete_helper<T, ODR_VIOLATION_PREVENTER>::type {};
template<typename T>
struct qRemovePointerLike
{