From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 4F41B386C58D; Mon, 27 Jun 2022 10:16:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4F41B386C58D MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r13-1285] libstdc++: Invert relationship between std::is_clock and std::is_clock_v X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: 153689603fd6aeb95b20a86f3a04fc5b93b01b09 X-Git-Newrev: 48099f7dafe8d10e92ddfc88c0fd5bfbb435d3d6 Message-Id: <20220627101637.4F41B386C58D@sourceware.org> Date: Mon, 27 Jun 2022 10:16:37 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jun 2022 10:16:37 -0000 https://gcc.gnu.org/g:48099f7dafe8d10e92ddfc88c0fd5bfbb435d3d6 commit r13-1285-g48099f7dafe8d10e92ddfc88c0fd5bfbb435d3d6 Author: Jonathan Wakely Date: Thu Jun 23 18:17:30 2022 +0100 libstdc++: Invert relationship between std::is_clock and std::is_clock_v 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. Diff: --- libstdc++-v3/include/bits/chrono.h | 45 +++++++++++++++----------------------- 1 file changed, 18 insertions(+), 27 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 - { }; + inline constexpr bool + is_clock_v<_Tp, void_t> + = __and_v>, + is_same, + is_same, + is_same>; +#endif template - struct is_clock : __is_clock_impl<_Tp>::type + struct is_clock + : bool_constant> { }; -#endif #endif // C++20 #if __cplusplus >= 201703L