3232#include < __type_traits/is_implicitly_default_constructible.h>
3333#include < __type_traits/is_nothrow_assignable.h>
3434#include < __type_traits/is_nothrow_constructible.h>
35- #include < __type_traits/is_reference.h>
3635#include < __type_traits/is_same.h>
3736#include < __type_traits/is_swappable.h>
3837#include < __type_traits/is_trivially_relocatable.h>
@@ -81,38 +80,6 @@ struct _LIBCPP_TEMPLATE_VIS pair
8180 _LIBCPP_HIDE_FROM_ABI pair (pair const &) = default;
8281 _LIBCPP_HIDE_FROM_ABI pair (pair&&) = default;
8382
84- // When we are requested for pair to be trivially copyable by the ABI macro, we use defaulted members
85- // if it is both legal to do it (i.e. no references) and we have a way to actually implement it, which requires
86- // the __enable_if__ attribute before C++20.
87- #ifdef _LIBCPP_ABI_TRIVIALLY_COPYABLE_PAIR
88- // FIXME: This should really just be a static constexpr variable. It's in a struct to avoid gdb printing the value
89- // when printing a pair
90- struct __has_defaulted_members {
91- static const bool value = !is_reference<first_type>::value && !is_reference<second_type>::value;
92- };
93- # if _LIBCPP_STD_VER >= 20
94- _LIBCPP_HIDE_FROM_ABI constexpr pair& operator =(const pair&)
95- requires __has_defaulted_members::value
96- = default ;
97-
98- _LIBCPP_HIDE_FROM_ABI constexpr pair& operator =(pair&&)
99- requires __has_defaulted_members::value
100- = default ;
101- # elif __has_attribute(__enable_if__)
102- _LIBCPP_HIDE_FROM_ABI pair& operator =(const pair&)
103- __attribute__ ((__enable_if__(__has_defaulted_members::value, " " ))) = default;
104-
105- _LIBCPP_HIDE_FROM_ABI pair& operator =(pair&&)
106- __attribute__ ((__enable_if__(__has_defaulted_members::value, " " ))) = default;
107- # else
108- # error "_LIBCPP_ABI_TRIVIALLY_COPYABLE_PAIR isn't supported with this compiler"
109- # endif
110- #else
111- struct __has_defaulted_members {
112- static const bool value = false ;
113- };
114- #endif // defined(_LIBCPP_ABI_TRIVIALLY_COPYABLE_PAIR) && __has_attribute(__enable_if__)
115-
11683#ifdef _LIBCPP_CXX03_LANG
11784 _LIBCPP_HIDE_FROM_ABI pair () : first(), second() {}
11885
@@ -258,8 +225,7 @@ struct _LIBCPP_TEMPLATE_VIS pair
258225 typename __make_tuple_indices<sizeof...(_Args2) >::type()) {}
259226
260227 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair&
261- operator =(__conditional_t <!__has_defaulted_members::value && is_copy_assignable<first_type>::value &&
262- is_copy_assignable<second_type>::value,
228+ operator =(__conditional_t <is_copy_assignable<first_type>::value && is_copy_assignable<second_type>::value,
263229 pair,
264230 __nat> const & __p) noexcept (is_nothrow_copy_assignable<first_type>::value &&
265231 is_nothrow_copy_assignable<second_type>::value) {
@@ -268,12 +234,10 @@ struct _LIBCPP_TEMPLATE_VIS pair
268234 return *this ;
269235 }
270236
271- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair&
272- operator =(__conditional_t <!__has_defaulted_members::value && is_move_assignable<first_type>::value &&
273- is_move_assignable<second_type>::value,
274- pair,
275- __nat>&& __p) noexcept (is_nothrow_move_assignable<first_type>::value &&
276- is_nothrow_move_assignable<second_type>::value) {
237+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair& operator =(
238+ __conditional_t <is_move_assignable<first_type>::value && is_move_assignable<second_type>::value, pair, __nat>&&
239+ __p) noexcept (is_nothrow_move_assignable<first_type>::value &&
240+ is_nothrow_move_assignable<second_type>::value) {
277241 first = std::forward<first_type>(__p.first );
278242 second = std::forward<second_type>(__p.second );
279243 return *this ;
0 commit comments