[libcxx-commits] [PATCH] D127230: [libc++][NFC] Simplify enable_if for std::copy optimization
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jun 7 10:17:58 PDT 2022
ldionne created this revision.
ldionne added a reviewer: philnik.
Herald added a project: All.
ldionne requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D127230
Files:
libcxx/include/__algorithm/copy.h
Index: libcxx/include/__algorithm/copy.h
===================================================================
--- libcxx/include/__algorithm/copy.h
+++ libcxx/include/__algorithm/copy.h
@@ -56,16 +56,11 @@
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,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127230.434864.patch
Type: text/x-patch
Size: 1491 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220607/410aa7f5/attachment.bin>
More information about the libcxx-commits
mailing list