aboutsummaryrefslogtreecommitdiff
path: root/libcxx/include/__algorithm/copy_move_common.h
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/include/__algorithm/copy_move_common.h')
-rw-r--r--libcxx/include/__algorithm/copy_move_common.h41
1 files changed, 8 insertions, 33 deletions
diff --git a/libcxx/include/__algorithm/copy_move_common.h b/libcxx/include/__algorithm/copy_move_common.h
index 0fc7a5e..12a26c6 100644
--- a/libcxx/include/__algorithm/copy_move_common.h
+++ b/libcxx/include/__algorithm/copy_move_common.h
@@ -19,7 +19,7 @@
#include <__type_traits/enable_if.h>
#include <__type_traits/is_always_bitcastable.h>
#include <__type_traits/is_constant_evaluated.h>
-#include <__type_traits/is_copy_constructible.h>
+#include <__type_traits/is_constructible.h>
#include <__type_traits/is_trivially_assignable.h>
#include <__type_traits/is_trivially_copyable.h>
#include <__type_traits/is_volatile.h>
@@ -81,30 +81,17 @@ __copy_backward_trivial_impl(_In* __first, _In* __last, _Out* __result) {
// Iterator unwrapping and dispatching to the correct overload.
-template <class _F1, class _F2>
-struct __overload : _F1, _F2 {
- using _F1::operator();
- using _F2::operator();
-};
-
-template <class _InIter, class _Sent, class _OutIter, class = void>
-struct __can_rewrap : false_type {};
-
-template <class _InIter, class _Sent, class _OutIter>
-struct __can_rewrap<_InIter,
- _Sent,
- _OutIter,
- // Note that sentinels are always copy-constructible.
- __enable_if_t< is_copy_constructible<_InIter>::value && is_copy_constructible<_OutIter>::value > >
- : true_type {};
+template <class _InIter, class _OutIter>
+struct __can_rewrap
+ : integral_constant<bool, is_copy_constructible<_InIter>::value && is_copy_constructible<_OutIter>::value> {};
template <class _Algorithm,
class _InIter,
class _Sent,
class _OutIter,
- __enable_if_t<__can_rewrap<_InIter, _Sent, _OutIter>::value, int> = 0>
+ __enable_if_t<__can_rewrap<_InIter, _OutIter>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 pair<_InIter, _OutIter>
-__unwrap_and_dispatch(_InIter __first, _Sent __last, _OutIter __out_first) {
+__copy_move_unwrap_iters(_InIter __first, _Sent __last, _OutIter __out_first) {
auto __range = std::__unwrap_range(__first, std::move(__last));
auto __result = _Algorithm()(std::move(__range.first), std::move(__range.second), std::__unwrap_iter(__out_first));
return std::make_pair(std::__rewrap_range<_Sent>(std::move(__first), std::move(__result.first)),
@@ -115,24 +102,12 @@ template <class _Algorithm,
class _InIter,
class _Sent,
class _OutIter,
- __enable_if_t<!__can_rewrap<_InIter, _Sent, _OutIter>::value, int> = 0>
+ __enable_if_t<!__can_rewrap<_InIter, _OutIter>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 pair<_InIter, _OutIter>
-__unwrap_and_dispatch(_InIter __first, _Sent __last, _OutIter __out_first) {
+__copy_move_unwrap_iters(_InIter __first, _Sent __last, _OutIter __out_first) {
return _Algorithm()(std::move(__first), std::move(__last), std::move(__out_first));
}
-template <class _AlgPolicy,
- class _NaiveAlgorithm,
- class _OptimizedAlgorithm,
- class _InIter,
- class _Sent,
- class _OutIter>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 pair<_InIter, _OutIter>
-__dispatch_copy_or_move(_InIter __first, _Sent __last, _OutIter __out_first) {
- using _Algorithm = __overload<_NaiveAlgorithm, _OptimizedAlgorithm>;
- return std::__unwrap_and_dispatch<_Algorithm>(std::move(__first), std::move(__last), std::move(__out_first));
-}
-
_LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS