[libcxx-commits] [libcxx] 7611eb4 - [libc++][NFC] Simplify enable_if for std::copy optimization
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jun 8 09:46:21 PDT 2022
Author: Louis Dionne
Date: 2022-06-08T12:46:08-04:00
New Revision: 7611eb4869db50bd35e7bdac0cadccc5533e78a2
URL: https://github.com/llvm/llvm-project/commit/7611eb4869db50bd35e7bdac0cadccc5533e78a2
DIFF: https://github.com/llvm/llvm-project/commit/7611eb4869db50bd35e7bdac0cadccc5533e78a2.diff
LOG: [libc++][NFC] Simplify enable_if for std::copy optimization
Get rid of the __is_trivially_copy_assignable_unwrapped helper, which
is only used in one place, and use __iter_value_type instead of
iterator_traits<T>::value_type.
Differential Revision: https://reviews.llvm.org/D127230
Added:
Modified:
libcxx/include/__algorithm/copy.h
Removed:
################################################################################
diff --git a/libcxx/include/__algorithm/copy.h b/libcxx/include/__algorithm/copy.h
index a09e03eb05ab4..2a4e535c6fb86 100644
--- a/libcxx/include/__algorithm/copy.h
+++ b/libcxx/include/__algorithm/copy.h
@@ -56,16 +56,11 @@ pair<_InValueT*, _OutValueT*> __copy_impl(_InValueT* __first, _InValueT* __last,
return std::make_pair(__first + __n, __result + __n);
}
-template <class _Iter>
-using __is_trivially_copy_assignable_unwrapped =
- _And<__is_cpp17_contiguous_iterator<_Iter>, is_trivially_copy_assignable<__iter_value_type<_Iter> > >;
-
-template <class _InIter,
- class _OutIter,
- class = __enable_if_t<is_same<typename remove_const<typename iterator_traits<_InIter>::value_type>::type,
- typename iterator_traits<_OutIter>::value_type>::value
- && __is_trivially_copy_assignable_unwrapped<_InIter>::value
- && __is_trivially_copy_assignable_unwrapped<_OutIter>::value> >
+template <class _InIter, class _OutIter,
+ __enable_if_t<is_same<typename remove_const<__iter_value_type<_InIter> >::type, __iter_value_type<_OutIter> >::value
+ && __is_cpp17_contiguous_iterator<_InIter>::value
+ && __is_cpp17_contiguous_iterator<_OutIter>::value
+ && is_trivially_copy_assignable<__iter_value_type<_OutIter> >::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
pair<reverse_iterator<_InIter>, reverse_iterator<_OutIter> >
__copy_impl(reverse_iterator<_InIter> __first,
More information about the libcxx-commits
mailing list