diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2024-07-27 23:34:35 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2024-10-23 18:26:01 +0000 |
commit | 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583 (patch) | |
tree | 6cf5ab1f05330c6773b1f3f64799d56a9c7a1faa /contrib/llvm-project/libcxx/include/__algorithm/copy_move_common.h | |
parent | 6b9f7133aba44189d9625c352bc2c2a59baf18ef (diff) | |
parent | ac9a064cb179f3425b310fa2847f8764ac970a4d (diff) |
Diffstat (limited to 'contrib/llvm-project/libcxx/include/__algorithm/copy_move_common.h')
-rw-r--r-- | contrib/llvm-project/libcxx/include/__algorithm/copy_move_common.h | 42 |
1 files changed, 8 insertions, 34 deletions
diff --git a/contrib/llvm-project/libcxx/include/__algorithm/copy_move_common.h b/contrib/llvm-project/libcxx/include/__algorithm/copy_move_common.h index 0fc7a5e3cee7..8a98451a8f96 100644 --- a/contrib/llvm-project/libcxx/include/__algorithm/copy_move_common.h +++ b/contrib/llvm-project/libcxx/include/__algorithm/copy_move_common.h @@ -19,9 +19,8 @@ #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> #include <__utility/move.h> #include <__utility/pair.h> @@ -81,30 +80,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 +101,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 |