From 3ef8ec2ee187b949b3f6840ca03bcc0e814c00a9 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 6 Jul 2020 14:06:08 +0200 Subject: Constrain the data stream operators for containers Check that we can successfully instantiate the data stream operator for a container before we actually try. This is required so we can automate registration of debug stream operators with QMetaType. Change-Id: Ib100a5242470d7fc8067058cc4d81af2fa9354b0 Reviewed-by: Fabian Kosmale --- src/corelib/global/qtypeinfo.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qtypeinfo.h b/src/corelib/global/qtypeinfo.h index 2f7bb414b5..e45347ee10 100644 --- a/src/corelib/global/qtypeinfo.h +++ b/src/corelib/global/qtypeinfo.h @@ -464,6 +464,17 @@ struct has_ostream_operator constexpr bool has_ostream_operator_v = has_ostream_operator::value; +template +struct has_istream_operator : std::false_type {}; +template +struct has_istream_operator() >> detail::reference())>> + : std::true_type {}; +template +constexpr bool has_istream_operator_v = has_istream_operator::value; + +template +constexpr bool has_stream_operator_v = has_ostream_operator_v && has_istream_operator_v; + } -- cgit v1.2.3