summaryrefslogtreecommitdiffstats
path: root/src/corelib/global
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-06-05 21:01:29 +0200
committerLars Knoll <lars.knoll@qt.io>2020-07-08 14:13:56 +0200
commit0e2cfdedf261a9d29d7466bd26545549479d9f8a (patch)
tree8c6b3eaaad7463bf2e019b0694286aa065544138 /src/corelib/global
parent16bc995fd1eba4f7485226f319e7736ca19040bc (diff)
Constrain the comparison operators for our container classes
This had already been in very few places, where we ran into issues with this before. More generic constraints here will significantly reduce the amount of error messages a user has to parse in case he tries to instantiate an operator by accident (or with a lacking comparison operator for one of it's template arguments). Change-Id: I1521d19c55d99732d9742402bd534c390a8e4242 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/global')
-rw-r--r--src/corelib/global/qtypeinfo.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/corelib/global/qtypeinfo.h b/src/corelib/global/qtypeinfo.h
index 8b31fb4a81..9b85a41266 100644
--- a/src/corelib/global/qtypeinfo.h
+++ b/src/corelib/global/qtypeinfo.h
@@ -432,6 +432,11 @@ struct has_operator_less_than : detail::expand_operator_less_than<T> {};
template<typename T>
constexpr bool has_operator_less_than_v = has_operator_less_than<T>::value;
+template <typename ...T>
+using compare_eq_result = std::enable_if_t<std::conjunction_v<QTypeTraits::has_operator_equal<T>...>, bool>;
+
+template <typename ...T>
+using compare_lt_result = std::enable_if_t<std::conjunction_v<QTypeTraits::has_operator_less_than<T>...>, bool>;
}