tst_qmetatype: Fix operator< detection for std::optional

Amends ca54b741d6.
operator< is not constrained in MSVC's standard library, either.

Pick-to: 6.2
Fixes: QTBUG-96690
Change-Id: Ibcbb9e53a1f9e8b13786f6d8c01489c61d8d2d7f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Fabian Kosmale 2021-09-21 11:13:06 +02:00
parent 4cc5428548
commit 01d94760d8
2 changed files with 4 additions and 0 deletions

View File

@ -311,6 +311,8 @@ using expand_operator_less_than_recursive = std::conjunction<expand_operator_les
template<typename T> template<typename T>
struct expand_operator_less_than_tuple : has_operator_less_than<T> {}; struct expand_operator_less_than_tuple : has_operator_less_than<T> {};
template<typename T>
struct expand_operator_less_than_tuple<std::optional<T>> : has_operator_less_than<T> {};
template<typename T1, typename T2> template<typename T1, typename T2>
struct expand_operator_less_than_tuple<std::pair<T1, T2>> : expand_operator_less_than_recursive<T1, T2> {}; struct expand_operator_less_than_tuple<std::pair<T1, T2>> : expand_operator_less_than_recursive<T1, T2> {};
template<typename ...T> template<typename ...T>

View File

@ -130,7 +130,9 @@ static_assert(!QTypeTraits::has_operator_less_than_v<std::map<int, NoOperators>>
// std::optional // std::optional
static_assert(QTypeTraits::has_operator_equal_v<std::optional<QString>>); static_assert(QTypeTraits::has_operator_equal_v<std::optional<QString>>);
static_assert(QTypeTraits::has_operator_less_than_v<std::optional<QString>>);
static_assert(!QTypeTraits::has_operator_equal_v<std::optional<NoOperators>>); static_assert(!QTypeTraits::has_operator_equal_v<std::optional<NoOperators>>);
static_assert(!QTypeTraits::has_operator_less_than_v<std::optional<NoOperators>>);
// nested types // nested types
static_assert(QTypeTraits::has_operator_equal_v<Nested>); static_assert(QTypeTraits::has_operator_equal_v<Nested>);