Re: [PATCH 2/2] libstdc++: use new built-in trait __add_const

2023-03-21 Thread Ken Matsui via Gcc-patches
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

Re: [PATCH 2/2] libstdc++: use new built-in trait __add_const

2023-03-21 Thread Jonathan Wakely via Gcc-patches
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

Re: [PATCH 2/2] libstdc++: use new built-in trait __add_const

2023-03-21 Thread Marc Glisse via Gcc-patches
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

[PATCH 2/2] libstdc++: use new built-in trait __add_const

2023-03-21 Thread Ken Matsui via Gcc-patches
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