[llvm-branch-commits] [libcxx] a2fb2a1 - Revert "[libc++][NFC] Simplify pair a bit (#96165)"
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Jun 27 22:02:43 PDT 2024
Author: James Y Knight
Date: 2024-06-28T01:02:40-04:00
New Revision: a2fb2a16f3d93364b8eaae82db443eb354299158
URL: https://github.com/llvm/llvm-project/commit/a2fb2a16f3d93364b8eaae82db443eb354299158
DIFF: https://github.com/llvm/llvm-project/commit/a2fb2a16f3d93364b8eaae82db443eb354299158.diff
LOG: Revert "[libc++][NFC] Simplify pair a bit (#96165)"
This reverts commit 54cb5ca9f48fc542b920662a0eee7c0e6f35bee0.
Added:
Modified:
libcxx/include/__utility/pair.h
Removed:
################################################################################
diff --git a/libcxx/include/__utility/pair.h b/libcxx/include/__utility/pair.h
index 1b0d9241886f9..0afbebcdc9f2a 100644
--- a/libcxx/include/__utility/pair.h
+++ b/libcxx/include/__utility/pair.h
@@ -16,6 +16,8 @@
#include <__fwd/array.h>
#include <__fwd/pair.h>
#include <__fwd/tuple.h>
+#include <__tuple/sfinae_helpers.h>
+#include <__tuple/tuple_element.h>
#include <__tuple/tuple_indices.h>
#include <__tuple/tuple_like_no_subrange.h>
#include <__tuple/tuple_size.h>
@@ -128,15 +130,19 @@ struct _LIBCPP_TEMPLATE_VIS pair
}
};
- template <bool _Dummy = true, __enable_if_t<_Dummy && _CheckArgs::__enable_default(), int> = 0>
- explicit(!_CheckArgs::__enable_implicit_default()) _LIBCPP_HIDE_FROM_ABI constexpr pair() noexcept(
+ template <bool _MaybeEnable>
+ using _CheckArgsDep _LIBCPP_NODEBUG =
+ typename conditional< _MaybeEnable, _CheckArgs, __check_tuple_constructor_fail>::type;
+
+ template <bool _Dummy = true, __enable_if_t<_CheckArgsDep<_Dummy>::__enable_default(), int> = 0>
+ explicit(!_CheckArgsDep<_Dummy>::__enable_implicit_default()) _LIBCPP_HIDE_FROM_ABI constexpr pair() noexcept(
is_nothrow_default_constructible<first_type>::value && is_nothrow_default_constructible<second_type>::value)
: first(), second() {}
- template <bool _Dummy = true,
- __enable_if_t<_Dummy && _CheckArgs::template __is_pair_constructible<_T1 const&, _T2 const&>(), int> = 0>
+ template <bool _Dummy = true,
+ __enable_if_t<_CheckArgsDep<_Dummy>::template __is_pair_constructible<_T1 const&, _T2 const&>(), int> = 0>
_LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(!_CheckArgs::template __is_implicit<_T1 const&, _T2 const&>())
+ _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit(!_CheckArgsDep<_Dummy>::template __is_implicit<_T1 const&, _T2 const&>())
pair(_T1 const& __t1, _T2 const& __t2) noexcept(is_nothrow_copy_constructible<first_type>::value &&
is_nothrow_copy_constructible<second_type>::value)
: first(__t1), second(__t2) {}
More information about the llvm-branch-commits
mailing list