[PATCH v26 05/13] libstdc++: Optimize std::add_pointer compilation performance
Jonathan Wakely
jwakely@redhat.com
Thu Jun 13 12:32:41 GMT 2024
On 11/05/24 02:01 -0700, Ken Matsui wrote:
>This patch optimizes the compilation performance of std::add_pointer
>by dispatching to the new __add_pointer built-in trait.
OK, thanks.
>libstdc++-v3/ChangeLog:
>
> * include/std/type_traits (add_pointer): Use __add_pointer
> built-in trait.
>
>Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
>---
> libstdc++-v3/include/std/type_traits | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
>diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
>index 1562757f886..6313fde94c2 100644
>--- a/libstdc++-v3/include/std/type_traits
>+++ b/libstdc++-v3/include/std/type_traits
>@@ -2149,6 +2149,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> { };
> #endif
>
>+ /// add_pointer
>+#if _GLIBCXX_USE_BUILTIN_TRAIT(__add_pointer)
>+ template<typename _Tp>
>+ struct add_pointer
>+ { using type = __add_pointer(_Tp); };
>+#else
> template<typename _Tp, typename = void>
> struct __add_pointer_helper
> { using type = _Tp; };
>@@ -2157,7 +2163,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> struct __add_pointer_helper<_Tp, __void_t<_Tp*>>
> { using type = _Tp*; };
>
>- /// add_pointer
> template<typename _Tp>
> struct add_pointer
> : public __add_pointer_helper<_Tp>
>@@ -2170,6 +2175,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> template<typename _Tp>
> struct add_pointer<_Tp&&>
> { using type = _Tp*; };
>+#endif
>
> #if __cplusplus > 201103L
> /// Alias template for remove_pointer
>--
>2.44.0
>
More information about the Libstdc++
mailing list