1919#include < __type_traits/enable_if.h>
2020#include < __type_traits/is_always_bitcastable.h>
2121#include < __type_traits/is_constant_evaluated.h>
22- #include < __type_traits/is_copy_constructible .h>
22+ #include < __type_traits/is_constructible .h>
2323#include < __type_traits/is_trivially_assignable.h>
24- #include < __type_traits/is_trivially_copyable.h>
2524#include < __type_traits/is_volatile.h>
2625#include < __utility/move.h>
2726#include < __utility/pair.h>
@@ -81,30 +80,17 @@ __copy_backward_trivial_impl(_In* __first, _In* __last, _Out* __result) {
8180
8281// Iterator unwrapping and dispatching to the correct overload.
8382
84- template <class _F1 , class _F2 >
85- struct __overload : _F1, _F2 {
86- using _F1::operator ();
87- using _F2::operator ();
88- };
89-
90- template <class _InIter , class _Sent , class _OutIter , class = void >
91- struct __can_rewrap : false_type {};
92-
93- template <class _InIter , class _Sent , class _OutIter >
94- struct __can_rewrap <_InIter,
95- _Sent,
96- _OutIter,
97- // Note that sentinels are always copy-constructible.
98- __enable_if_t < is_copy_constructible<_InIter>::value && is_copy_constructible<_OutIter>::value > >
99- : true_type {};
83+ template <class _InIter , class _OutIter >
84+ struct __can_rewrap
85+ : integral_constant<bool , is_copy_constructible<_InIter>::value && is_copy_constructible<_OutIter>::value> {};
10086
10187template <class _Algorithm ,
10288 class _InIter ,
10389 class _Sent ,
10490 class _OutIter ,
105- __enable_if_t <__can_rewrap<_InIter, _Sent, _OutIter>::value, int > = 0 >
91+ __enable_if_t <__can_rewrap<_InIter, _OutIter>::value, int > = 0 >
10692_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 pair<_InIter, _OutIter>
107- __unwrap_and_dispatch (_InIter __first, _Sent __last, _OutIter __out_first) {
93+ __copy_move_unwrap_iters (_InIter __first, _Sent __last, _OutIter __out_first) {
10894 auto __range = std::__unwrap_range (__first, std::move (__last));
10995 auto __result = _Algorithm ()(std::move (__range.first ), std::move (__range.second ), std::__unwrap_iter (__out_first));
11096 return std::make_pair (std::__rewrap_range<_Sent>(std::move (__first), std::move (__result.first )),
@@ -115,24 +101,12 @@ template <class _Algorithm,
115101 class _InIter ,
116102 class _Sent ,
117103 class _OutIter ,
118- __enable_if_t <!__can_rewrap<_InIter, _Sent, _OutIter>::value, int > = 0 >
104+ __enable_if_t <!__can_rewrap<_InIter, _OutIter>::value, int > = 0 >
119105_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 pair<_InIter, _OutIter>
120- __unwrap_and_dispatch (_InIter __first, _Sent __last, _OutIter __out_first) {
106+ __copy_move_unwrap_iters (_InIter __first, _Sent __last, _OutIter __out_first) {
121107 return _Algorithm ()(std::move (__first), std::move (__last), std::move (__out_first));
122108}
123109
124- template <class _AlgPolicy ,
125- class _NaiveAlgorithm ,
126- class _OptimizedAlgorithm ,
127- class _InIter ,
128- class _Sent ,
129- class _OutIter >
130- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 pair<_InIter, _OutIter>
131- __dispatch_copy_or_move (_InIter __first, _Sent __last, _OutIter __out_first) {
132- using _Algorithm = __overload<_NaiveAlgorithm, _OptimizedAlgorithm>;
133- return std::__unwrap_and_dispatch<_Algorithm>(std::move (__first), std::move (__last), std::move (__out_first));
134- }
135-
136110_LIBCPP_END_NAMESPACE_STD
137111
138112_LIBCPP_POP_MACROS
0 commit comments