This patch optimizes the compilation performance of std::add_pointer
by dispatching to the new __add_pointer built-in trait.
libstdc++-v3/ChangeLog:
* include/std/type_traits (add_pointer): Use __add_pointer
built-in trait.
Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
Reviewed-by: Patrick Palka <ppalka@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
{ };
#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; };
struct __add_pointer_helper<_Tp, __void_t<_Tp*>>
{ using type = _Tp*; };
- /// add_pointer
template<typename _Tp>
struct add_pointer
: public __add_pointer_helper<_Tp>
template<typename _Tp>
struct add_pointer<_Tp&&>
{ using type = _Tp*; };
+#endif
#if __cplusplus > 201103L
/// Alias template for remove_pointer