[libcxx-commits] [pstl] r366233 - [pstl] Use std::transform_reduce instead of hand-rolled implementation
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jul 16 10:29:09 PDT 2019
Author: ldionne
Date: Tue Jul 16 10:29:09 2019
New Revision: 366233
URL: http://llvm.org/viewvc/llvm-project?rev=366233&view=rev
Log:
[pstl] Use std::transform_reduce instead of hand-rolled implementation
Modified:
pstl/trunk/include/pstl/internal/numeric_impl.h
Modified: pstl/trunk/include/pstl/internal/numeric_impl.h
URL: http://llvm.org/viewvc/llvm-project/pstl/trunk/include/pstl/internal/numeric_impl.h?rev=366233&r1=366232&r2=366233&view=diff
==============================================================================
--- pstl/trunk/include/pstl/internal/numeric_impl.h (original)
+++ pstl/trunk/include/pstl/internal/numeric_impl.h Tue Jul 16 10:29:09 2019
@@ -93,11 +93,7 @@ _Tp
__brick_transform_reduce(_ForwardIterator __first, _ForwardIterator __last, _Tp __init, _BinaryOperation __binary_op,
_UnaryOperation __unary_op, /*is_vector=*/std::false_type) noexcept
{
- for (; __first != __last; ++__first)
- {
- __init = __binary_op(__init, __unary_op(*__first));
- }
- return __init;
+ return std::transform_reduce(__first, __last, __init, __binary_op, __unary_op);
}
template <class _ForwardIterator, class _Tp, class _UnaryOperation, class _BinaryOperation>
More information about the libcxx-commits
mailing list