[PATCH 2/2] libstdc++: use new built-in trait __add_const
Ken Matsui
kmatsui@cs.washington.edu
Tue Mar 21 11:10:56 GMT 2023
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_traits b/libstdc++-v3/include/std/type_traits
index 2bd607a8b8f..1ac75a928c3 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -1560,9 +1560,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#endif
/// add_const
+#if __has_builtin(__add_const)
+ template<typename _Tp>
+ struct add_const
+ { using type = __add_const(_Tp); };
+#else
template<typename _Tp>
struct add_const
{ using type = _Tp const; };
+#endif
/// add_volatile
template<typename _Tp>
--
2.40.0
More information about the Libstdc++
mailing list