diff options
author | Martin Liska <mliska@suse.cz> | 2022-09-06 06:52:14 +0200 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2022-09-06 06:52:14 +0200 |
commit | 918bc838c2803f08e4d7ccd179396d48cb8ec804 (patch) | |
tree | 2496c039b51fd33ee4309d910f0f6ce44cd5f749 /libstdc++-v3 | |
parent | 8de5354e2cf4e6ea750ea92c7162d61b1b796f76 (diff) | |
parent | 47d2dcd1397bf02b79515c39438e0ea9898f9056 (diff) | |
download | gcc-918bc838c2803f08e4d7ccd179396d48cb8ec804.zip gcc-918bc838c2803f08e4d7ccd179396d48cb8ec804.tar.gz gcc-918bc838c2803f08e4d7ccd179396d48cb8ec804.tar.bz2 |
Merge branch 'master' into devel/sphinx
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/ChangeLog | 12 | ||||
-rw-r--r-- | libstdc++-v3/include/std/type_traits | 51 |
2 files changed, 39 insertions, 24 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index d905767..c9a7f35 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,15 @@ +2022-09-05 Jonathan Wakely <jwakely@redhat.com> + + * include/std/type_traits (__success_type, __failure_type): Move + definitions later in the file. + +2022-09-05 Jonathan Wakely <jwakely@redhat.com> + + * include/std/type_traits (is_trivial_v, is_trivially_copyable_v) + (is_standard_layout_v, is_pod_v, is_literal_type_v): Use + built-in instead of class template. + (is_same_v): Add partial specialization for true case. + 2022-09-02 Patrick Palka <ppalka@redhat.com> * include/std/tuple (tuple::_UseOtherCtor): Use ::type when diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index c7a9607..e4d1679 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -286,18 +286,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >::type __is_complete_or_unbounded(_TypeIdentity) { return {}; } - // For several sfinae-friendly trait implementations we transport both the - // result information (as the member type) and the failure information (no - // member type). This is very similar to std::enable_if, but we cannot use - // them, because we need to derive from them as an implementation detail. - - template<typename _Tp> - struct __success_type - { typedef _Tp type; }; - - struct __failure_type - { }; - // __remove_cv_t (std::remove_cv_t for C++11). template<typename _Tp> using __remove_cv_t = typename remove_cv<_Tp>::type; @@ -2162,6 +2150,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Sfinae-friendly common_type implementation: /// @cond undocumented + + // For several sfinae-friendly trait implementations we transport both the + // result information (as the member type) and the failure information (no + // member type). This is very similar to std::enable_if, but we cannot use + // that, because we need to derive from them as an implementation detail. + + template<typename _Tp> + struct __success_type + { typedef _Tp type; }; + + struct __failure_type + { }; + struct __do_common_type_impl { template<typename _Tp, typename _Up> @@ -3077,22 +3078,19 @@ template <typename _Tp> inline constexpr bool is_volatile_v = false; template <typename _Tp> inline constexpr bool is_volatile_v<volatile _Tp> = true; + template <typename _Tp> - inline constexpr bool is_trivial_v = is_trivial<_Tp>::value; + inline constexpr bool is_trivial_v = __is_trivial(_Tp); template <typename _Tp> - inline constexpr bool is_trivially_copyable_v = - is_trivially_copyable<_Tp>::value; + inline constexpr bool is_trivially_copyable_v = __is_trivially_copyable(_Tp); template <typename _Tp> - inline constexpr bool is_standard_layout_v = is_standard_layout<_Tp>::value; -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + inline constexpr bool is_standard_layout_v = __is_standard_layout(_Tp); template <typename _Tp> _GLIBCXX20_DEPRECATED("use is_standard_layout_v && is_trivial_v instead") - inline constexpr bool is_pod_v = is_pod<_Tp>::value; + inline constexpr bool is_pod_v = __is_pod(_Tp); template <typename _Tp> _GLIBCXX17_DEPRECATED - inline constexpr bool is_literal_type_v = is_literal_type<_Tp>::value; -#pragma GCC diagnostic pop + inline constexpr bool is_literal_type_v = __is_literal_type(_Tp); template <typename _Tp> inline constexpr bool is_empty_v = __is_empty(_Tp); template <typename _Tp> @@ -3101,6 +3099,7 @@ template <typename _Tp> inline constexpr bool is_abstract_v = __is_abstract(_Tp); template <typename _Tp> inline constexpr bool is_final_v = __is_final(_Tp); + template <typename _Tp> inline constexpr bool is_signed_v = is_signed<_Tp>::value; template <typename _Tp> @@ -3183,9 +3182,11 @@ template <typename _Tp> template <typename _Tp> inline constexpr bool is_nothrow_destructible_v = is_nothrow_destructible<_Tp>::value; + template <typename _Tp> - inline constexpr bool has_virtual_destructor_v = - has_virtual_destructor<_Tp>::value; + inline constexpr bool has_virtual_destructor_v + = __has_virtual_destructor(_Tp); + template <typename _Tp> inline constexpr size_t alignment_of_v = alignment_of<_Tp>::value; @@ -3212,7 +3213,9 @@ template <typename _Tp, typename _Up> inline constexpr bool is_same_v = __is_same(_Tp, _Up); #else template <typename _Tp, typename _Up> - inline constexpr bool is_same_v = std::is_same<_Tp, _Up>::value; + inline constexpr bool is_same_v = false; +template <typename _Tp> + inline constexpr bool is_same_v<_Tp, _Tp> = true; #endif template <typename _Base, typename _Derived> inline constexpr bool is_base_of_v = __is_base_of(_Base, _Derived); |