public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* Question about _GLIBCXX_HAVE_BUILTIN_IS_SAME
@ 2024-02-07 21:58 Ken Matsui
  2024-02-08  0:13 ` Jonathan Wakely
  0 siblings, 1 reply; 4+ messages in thread
From: Ken Matsui @ 2024-02-07 21:58 UTC (permalink / raw)
  To: libstdc++

Hi,

I found we are using _GLIBCXX_HAVE_BUILTIN_IS_SAME in type_traits, but I
think we can use _GLIBCXX_USE_BUILTIN_TRAIT(__is_same) instead.  I feel
this is a bit more readable and consistent with other traits.  With this
change, AFAIK, _GLIBCXX_HAVE_BUILTIN_IS_SAME is not used anywhere, but
can we completely remove it from gcc/libstdc++-v3/include/bits/c++config
or is there any reason to keep it?

   /// is_same
+#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_same)
   template<typename _Tp, typename _Up>
     struct is_same
-#ifdef _GLIBCXX_HAVE_BUILTIN_IS_SAME
     : public __bool_constant<__is_same(_Tp, _Up)>
+    { };
 #else
+  template<typename _Tp, typename _Up>
+    struct is_same
     : public false_type
-#endif
     { };
 
-#ifndef _GLIBCXX_HAVE_BUILTIN_IS_SAME
   template<typename _Tp>
     struct is_same<_Tp, _Tp>
     : public true_type
    { };
#endif

I am also wondering if we could replace other _GLIBCXX_HAVE_BUILTIN_*
macros with _GLIBCXX_USE_BUILTIN_TRAIT(*):

* _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP
* _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE
* _GLIBCXX_HAVE_BUILTIN_LAUNDER

-- 
Ken Matsui

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

end of thread, other threads:[~2024-02-13 23:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-07 21:58 Question about _GLIBCXX_HAVE_BUILTIN_IS_SAME Ken Matsui
2024-02-08  0:13 ` Jonathan Wakely
2024-02-09 19:35   ` Ken Matsui
2024-02-13 23:34     ` 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).