From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7934) id 1F12A3858436; Mon, 10 Jul 2023 05:41:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1F12A3858436 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688967691; bh=6Y5BxyjyOoBJob1no8GE2dvvzvII3F0JhB1nbRJKjCk=; h=From:To:Subject:Date:From; b=DFWlXgZWygb+KLQfVam+QUzPXAWKqH+XmY8pw5yuYQb6smMlfq9KZrOuJP974JGNA t+TJ37TODRDxXtqrT4yYzsR59XSt+0EmJkBTvc+9/OxViPkeb4M9KzAnvmBuoy1y7Y iScMQ0FbK5fsEyDKC1sL5a0/SGx1yoGVrxvWlaBw= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Ken Matsui To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc(refs/users/kmatsui/heads/is_pointer)] libstdc++: use new built-in trait __is_pointer X-Act-Checkin: gcc X-Git-Author: Ken Matsui X-Git-Refname: refs/users/kmatsui/heads/is_pointer X-Git-Oldrev: 50968079e028d6e563da195d407fd418f9e20680 X-Git-Newrev: b12e0ee48cb9b188e0e8fe48d24a0c7bb46282f0 Message-Id: <20230710054131.1F12A3858436@sourceware.org> Date: Mon, 10 Jul 2023 05:41:31 +0000 (GMT) List-Id: https://gcc.gnu.org/g:b12e0ee48cb9b188e0e8fe48d24a0c7bb46282f0 commit b12e0ee48cb9b188e0e8fe48d24a0c7bb46282f0 Author: Ken Matsui Date: Sun Jul 9 22:20:20 2023 -0700 libstdc++: use new built-in trait __is_pointer This patch lets libstdc++ use new built-in trait __is_pointer. libstdc++-v3/ChangeLog: * include/std/type_traits (is_pointer): Use __is_pointer built-in trait. (is_pointer_v): Likewise. Signed-off-by: Ken Matsui Diff: --- libstdc++-v3/include/std/type_traits | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 0e7a9c9c7f3..b8291a31d3e 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -515,6 +515,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION struct is_array<_Tp[]> : public true_type { }; + /// is_pointer +#if __has_builtin(__is_pointer) + template + struct is_pointer + : public __bool_constant<__is_pointer(_Tp)> + { }; +#else template struct __is_pointer_helper : public false_type { }; @@ -523,11 +530,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION struct __is_pointer_helper<_Tp*> : public true_type { }; - /// is_pointer template struct is_pointer : public __is_pointer_helper<__remove_cv_t<_Tp>>::type { }; +#endif /// is_lvalue_reference template @@ -3168,8 +3175,14 @@ template template inline constexpr bool is_array_v<_Tp[_Num]> = true; +#if __has_builtin(__is_pointer) +template + inline constexpr bool is_pointer_v = __is_pointer(_Tp); +#else template inline constexpr bool is_pointer_v = is_pointer<_Tp>::value; +#endif + template inline constexpr bool is_lvalue_reference_v = false; template