From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7934) id A4B9F3856967; Sat, 8 Jul 2023 05:21:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A4B9F3856967 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688793664; bh=AMFtB63NmU/DkK4TKXL8x7m8kceMw7Dec49Psz37Fks=; h=From:To:Subject:Date:From; b=rRuQdL+LfpSu3pEEw8YlXC4diMGxSh/ZtxIY4r+fVVOvI/wWHNBDZMR/GsPvTtGva Zym1tgHg8FsNV8fG8tasAGiQ/92s68LRr5kKYT/RAOFmUtGy4PXQ1IK3pE0ElekZFB qn7GzT+zYbJKobCTG843kJcsqawFUJkKxrOu7teE= 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_array)] libstdc++: use new built-in trait __is_array X-Act-Checkin: gcc X-Git-Author: Ken Matsui X-Git-Refname: refs/users/kmatsui/heads/is_array X-Git-Oldrev: 6d1fdf55bdec405b9e0c6d92c4648c67971fb0d8 X-Git-Newrev: 1245a9e56d9736bcb3250cec9de648d386d1fde8 Message-Id: <20230708052104.A4B9F3856967@sourceware.org> Date: Sat, 8 Jul 2023 05:21:04 +0000 (GMT) List-Id: https://gcc.gnu.org/g:1245a9e56d9736bcb3250cec9de648d386d1fde8 commit 1245a9e56d9736bcb3250cec9de648d386d1fde8 Author: Ken Matsui Date: Tue Mar 21 08:57:14 2023 -0700 libstdc++: use new built-in trait __is_array This patch lets libstdc++ use new built-in trait __is_array. libstdc++-v3/ChangeLog: * include/std/type_traits (is_array): Use __is_array built-in trait. (is_array_v): Likewise. Signed-off-by: Ken Matsui Diff: --- libstdc++-v3/include/std/type_traits | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 0e7a9c9c7f3..f2a3a327e7d 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -503,6 +503,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { }; /// is_array +#if __has_builtin(__is_array) + template + struct is_array + : public __bool_constant<__is_array(_Tp)> + { }; +#else template struct is_array : public false_type { }; @@ -514,6 +520,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template struct is_array<_Tp[]> : public true_type { }; +#endif template struct __is_pointer_helper @@ -3161,12 +3168,17 @@ template template inline constexpr bool is_floating_point_v = is_floating_point<_Tp>::value; +#if __has_builtin(__is_array) +template + inline constexpr bool is_array_v = __is_array(_Tp); +#else template inline constexpr bool is_array_v = false; template inline constexpr bool is_array_v<_Tp[]> = true; template inline constexpr bool is_array_v<_Tp[_Num]> = true; +#endif template inline constexpr bool is_pointer_v = is_pointer<_Tp>::value;