[2/2] libstdc++: use new built-in trait __is_arithmetic
Checks
Commit Message
This patch lets libstdc++ use new built-in trait __is_arithmetic.
libstdc++-v3/ChangeLog:
* include/std/type_traits (is_arithmetic): Use __is_arithmetic
built-in trait.
(is_arithmetic_v): Likewise.
Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
libstdc++-v3/include/std/type_traits | 14 ++++++++++++++
1 file changed, 14 insertions(+)
@@ -655,10 +655,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ };
/// is_arithmetic
+#if __has_builtin(__is_arithmetic)
+ template<typename _Tp>
+ struct is_arithmetic
+ : public __bool_constant<__is_arithmetic(_Tp)>
+ { };
+#else
template<typename _Tp>
struct is_arithmetic
: public __or_<is_integral<_Tp>, is_floating_point<_Tp>>::type
{ };
+#endif
/// is_fundamental
template<typename _Tp>
@@ -3198,8 +3205,15 @@ template <typename _Tp>
inline constexpr bool is_reference_v<_Tp&> = true;
template <typename _Tp>
inline constexpr bool is_reference_v<_Tp&&> = true;
+
+#if __has_builtin(__is_arithmetic)
+template <typename _Tp>
+ inline constexpr bool is_arithmetic_v = __is_arithmetic(_Tp);
+#else
template <typename _Tp>
inline constexpr bool is_arithmetic_v = is_arithmetic<_Tp>::value;
+#endif
+
template <typename _Tp>
inline constexpr bool is_fundamental_v = is_fundamental<_Tp>::value;
template <typename _Tp>