From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 51C18386F0FF for ; Mon, 27 Jun 2022 10:17:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 51C18386F0FF Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-77-ku_pvRFQN_uYe1by4x7WAg-1; Mon, 27 Jun 2022 06:16:58 -0400 X-MC-Unique: ku_pvRFQN_uYe1by4x7WAg-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3FCC83803505; Mon, 27 Jun 2022 10:16:58 +0000 (UTC) Received: from localhost (unknown [10.33.36.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 097E240F06D; Mon, 27 Jun 2022 10:16:57 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Invert relationship between std::is_clock and std::is_clock_v Date: Mon, 27 Jun 2022 11:16:57 +0100 Message-Id: <20220627101657.33845-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jun 2022 10:17:01 -0000 Tested powerpc64le-linux, pushed to trunk. -- >8 -- This redefines std::is_clock in terms of std::is_clock_v, instead of the other way around. This avoids instantiatng the class template for code that only uses the variable template. libstdc++-v3/ChangeLog: * include/bits/chrono.h (is_clock_v): Define to false. (is_clock_v): Define partial specialization for true cases. (is_clock): Define in terms of is_clock_v. --- libstdc++-v3/include/bits/chrono.h | 49 ++++++++++++------------------ 1 file changed, 20 insertions(+), 29 deletions(-) diff --git a/libstdc++-v3/include/bits/chrono.h b/libstdc++-v3/include/bits/chrono.h index 745f9a81357..05987ca09df 100644 --- a/libstdc++-v3/include/bits/chrono.h +++ b/libstdc++-v3/include/bits/chrono.h @@ -273,16 +273,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif // C++17 #if __cplusplus > 201703L - template - struct is_clock; - - template - inline constexpr bool is_clock_v = is_clock<_Tp>::value; - #if __cpp_lib_concepts template - struct is_clock : false_type - { }; + inline constexpr bool is_clock_v = false; template requires requires { @@ -298,32 +291,30 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION requires same_as; } - struct is_clock<_Tp> : true_type - { }; + inline constexpr bool is_clock_v<_Tp> = true; #else template - struct __is_clock_impl : false_type - { }; + inline constexpr bool is_clock_v = false; template - struct __is_clock_impl<_Tp, - void_t> - : __and_>, - is_same, - is_same, - is_same>::type - { }; - - template - struct is_clock : __is_clock_impl<_Tp>::type - { }; + inline constexpr bool + is_clock_v<_Tp, void_t> + = __and_v>, + is_same, + is_same, + is_same>; #endif + + template + struct is_clock + : bool_constant> + { }; #endif // C++20 #if __cplusplus >= 201703L -- 2.36.1