Thank you for your information. Although it matches my intuition, I sent
this patch because I was unsure my intuition was correct. As Jonathan
pointed out, there appear to be several implementation errors. The
benchmark result for this trait is kind of trivial, so I will implement the
other traits
On Tue, 21 Mar 2023 at 11:21, Marc Glisse via Libstdc++ <
libstd...@gcc.gnu.org> wrote:
> On Tue, 21 Mar 2023, Ken Matsui via Libstdc++ wrote:
>
> > /// add_const
> > +#if __has_builtin(__add_const)
> > + template
> > +struct add_const
> > +{ using type = __add_const(_Tp); };
> > +#else
On Tue, 21 Mar 2023, Ken Matsui via Libstdc++ wrote:
/// add_const
+#if __has_builtin(__add_const)
+ template
+struct add_const
+{ using type = __add_const(_Tp); };
+#else
template
struct add_const
{ using type = _Tp const; };
+#endif
Is that really better? You asked elsew
This patch lets libstdc++ use new built-in trait __add_const.
libstdc++-v3/ChangeLog:
* include/std/type_traits (add_const): Use __add_const built-in trait.
---
libstdc++-v3/include/std/type_traits | 6 ++
1 file changed, 6 insertions(+)
diff --git a/libstdc++-v3/include/std/type_tr