This patch optimizes the compilation performance of std::remove_extent
by dispatching to the new __builtin_remove_extent trait.
libstdc++-v3/ChangeLog:
* include/std/type_traits (remove_extent): Use
__builtin_remove_extent trait.
Signed-off-by: Ken Matsui <[email protected]>
---
libstdc++-v3/include/std/type_traits | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/libstdc++-v3/include/std/type_traits
b/libstdc++-v3/include/std/type_traits
index 59d952194af..36136440fdd 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -2092,6 +2092,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Array modifications.
/// remove_extent
+#if _GLIBCXX_USE_BUILTIN_TRAIT(__builtin_remove_extent)
+ template<typename _Tp>
+ struct remove_extent
+ { using type = __builtin_remove_extent(_Tp); };
+#else
template<typename _Tp>
struct remove_extent
{ using type = _Tp; };
@@ -2103,6 +2108,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Tp>
struct remove_extent<_Tp[]>
{ using type = _Tp; };
+#endif
/// remove_all_extents
template<typename _Tp>
--
2.44.0