From 6de9acf7793a299322923b3ac02142a5e5998842 Mon Sep 17 00:00:00 2001 From: Fabian Kosmale Date: Thu, 15 Oct 2020 16:30:31 +0200 Subject: [PATCH] qtypeinfo: make variable templates inline And refactor the TMP to use std::conjunction and use variable template specialization instead of template class specialization for the base cases. Change-Id: Iea6a03f13ea3443a0fa7365af21c496670c1e07f Reviewed-by: Qt CI Bot Reviewed-by: Lars Knoll --- src/corelib/global/qtypeinfo.h | 37 +++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/src/corelib/global/qtypeinfo.h b/src/corelib/global/qtypeinfo.h index e5914414f2..fea6ecd45c 100644 --- a/src/corelib/global/qtypeinfo.h +++ b/src/corelib/global/qtypeinfo.h @@ -311,14 +311,13 @@ struct expand_operator_less_than_tuple> : expand_operator_les } template -struct is_dereferenceable : std::false_type {}; +inline constexpr bool is_dereferenceable_v = false; template -struct is_dereferenceable().operator->())> > - : std::true_type {}; +inline constexpr bool is_dereferenceable_v().operator->())> > = true; template -inline constexpr bool is_dereferenceable_v = is_dereferenceable::value; +using is_dereferenceable = std::bool_constant>; template struct has_operator_equal : detail::expand_operator_equal {}; @@ -345,25 +344,31 @@ T &reference(); } -template -struct has_ostream_operator : std::false_type {}; -template -struct has_ostream_operator() << detail::const_reference())>> - : std::true_type {}; -template -inline constexpr bool has_ostream_operator_v = has_ostream_operator::value; +template +inline constexpr bool has_ostream_operator_v = false; -template -struct has_istream_operator : std::false_type {}; template -struct has_istream_operator() >> detail::reference())>> - : std::true_type {}; +inline constexpr bool has_ostream_operator_v() << detail::const_reference())>> = true; + template -inline constexpr bool has_istream_operator_v = has_istream_operator::value; +using has_ostream_operator = std::bool_constant>; + + + +template +inline constexpr bool has_istream_operator_v = false; + +template +inline constexpr bool has_istream_operator_v() >> detail::reference())>> = true; + +template +using has_istream_operator = std::bool_constant>; template inline constexpr bool has_stream_operator_v = has_ostream_operator_v && has_istream_operator_v; +template +using has_stream_operator = std::conjunction, has_istream_operator>; }