public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/kmatsui/heads/is_pointer)] libstdc++: use new built-in trait __is_pointer
@ 2023-07-10  5:24 Ken Matsui
  0 siblings, 0 replies; 2+ messages in thread
From: Ken Matsui @ 2023-07-10  5:24 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

https://gcc.gnu.org/g:5e5eab817fd593625b385ff6b48993b6c77eb277

commit 5e5eab817fd593625b385ff6b48993b6c77eb277
Author: Ken Matsui <kmatsui@gcc.gnu.org>
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 <kmatsui@gcc.gnu.org>

Diff:
---
 libstdc++-v3/include/std/type_traits | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index 0e7a9c9c7f3..d83db98403b 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<typename _Tp>
+    struct is_pointer
+    : public __bool_constant<__is_pointer(_Tp)>
+    { };
+#else
   template<typename>
     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<typename _Tp>
     struct is_pointer
     : public __is_pointer_helper<__remove_cv_t<_Tp>>::type
     { };
+#endif
 
   /// is_lvalue_reference
   template<typename>

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [gcc(refs/users/kmatsui/heads/is_pointer)] libstdc++: use new built-in trait __is_pointer
@ 2023-07-10  5:41 Ken Matsui
  0 siblings, 0 replies; 2+ messages in thread
From: Ken Matsui @ 2023-07-10  5:41 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

https://gcc.gnu.org/g:b12e0ee48cb9b188e0e8fe48d24a0c7bb46282f0

commit b12e0ee48cb9b188e0e8fe48d24a0c7bb46282f0
Author: Ken Matsui <kmatsui@gcc.gnu.org>
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 <kmatsui@gcc.gnu.org>

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<typename _Tp>
+    struct is_pointer
+    : public __bool_constant<__is_pointer(_Tp)>
+    { };
+#else
   template<typename>
     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<typename _Tp>
     struct is_pointer
     : public __is_pointer_helper<__remove_cv_t<_Tp>>::type
     { };
+#endif
 
   /// is_lvalue_reference
   template<typename>
@@ -3168,8 +3175,14 @@ template <typename _Tp>
 template <typename _Tp, size_t _Num>
   inline constexpr bool is_array_v<_Tp[_Num]> = true;
 
+#if __has_builtin(__is_pointer)
+template <typename _Tp>
+  inline constexpr bool is_pointer_v = __is_pointer(_Tp);
+#else
 template <typename _Tp>
   inline constexpr bool is_pointer_v = is_pointer<_Tp>::value;
+#endif
+
 template <typename _Tp>
   inline constexpr bool is_lvalue_reference_v = false;
 template <typename _Tp>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-10  5:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-10  5:24 [gcc(refs/users/kmatsui/heads/is_pointer)] libstdc++: use new built-in trait __is_pointer Ken Matsui
2023-07-10  5:41 Ken Matsui

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).