Cleanup algorithm implementations

* include/pstl/glue_algorithm_impl.h (stable_sort): Forward
        execution policy.
	(mismatch): Forward execution policy.
	(equal): Qualify call to std::equal().
	(partial_sort): Forward execution policy.
	(inplace_merge): Forward execution policy.

From-SVN: r270471
This commit is contained in:
Thomas Rodgers 2019-04-20 22:45:58 +00:00 committed by Thomas Rodgers
parent 0aa94749cb
commit 9762ea561d
2 changed files with 17 additions and 7 deletions

View File

@ -1,3 +1,13 @@
2019-04-20 Thomas Rodgers <trodgers@redhat.com>
Cleanup algorithm implementations
* include/pstl/glue_algorithm_impl.h (stable_sort): Forward
execution policy.
(mismatch): Forward execution policy.
(equal): Qualify call to std::equal().
(partial_sort): Forward execution policy.
(inplace_merge): Forward execution policy.
2019-04-19 Thomas Rodgers <trodgers@redhat.com> 2019-04-19 Thomas Rodgers <trodgers@redhat.com>
Improve implementation of parallel equal() Improve implementation of parallel equal()

View File

@ -674,7 +674,7 @@ __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void>
stable_sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last) stable_sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last)
{ {
typedef typename std::iterator_traits<_RandomAccessIterator>::value_type _InputType; typedef typename std::iterator_traits<_RandomAccessIterator>::value_type _InputType;
std::stable_sort(__exec, __first, __last, std::less<_InputType>()); std::stable_sort(std::forward<_ExecutionPolicy>(__exec), __first, __last, std::less<_InputType>());
} }
// [mismatch] // [mismatch]
@ -696,8 +696,8 @@ __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, std::pair<_Fo
mismatch(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, mismatch(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
_BinaryPredicate __pred) _BinaryPredicate __pred)
{ {
return std::mismatch(__exec, __first1, __last1, __first2, std::next(__first2, std::distance(__first1, __last1)), return std::mismatch(std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __first2,
__pred); std::next(__first2, std::distance(__first1, __last1)), __pred);
} }
template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2> template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2>
@ -757,8 +757,8 @@ __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, bool>
equal(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, equal(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
_ForwardIterator2 __last2) _ForwardIterator2 __last2)
{ {
return equal(std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __first2, __last2, return std::equal(std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __first2, __last2,
__pstl::__internal::__pstl_equal()); __pstl::__internal::__pstl_equal());
} }
// [alg.move] // [alg.move]
@ -798,7 +798,7 @@ partial_sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAc
_RandomAccessIterator __last) _RandomAccessIterator __last)
{ {
typedef typename iterator_traits<_RandomAccessIterator>::value_type _InputType; typedef typename iterator_traits<_RandomAccessIterator>::value_type _InputType;
std::partial_sort(__exec, __first, __middle, __last, std::less<_InputType>()); std::partial_sort(std::forward<_ExecutionPolicy>(__exec), __first, __middle, __last, std::less<_InputType>());
} }
// [partial.sort.copy] // [partial.sort.copy]
@ -908,7 +908,7 @@ inplace_merge(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _Bidire
_BidirectionalIterator __last) _BidirectionalIterator __last)
{ {
typedef typename std::iterator_traits<_BidirectionalIterator>::value_type _InputType; typedef typename std::iterator_traits<_BidirectionalIterator>::value_type _InputType;
std::inplace_merge(__exec, __first, __middle, __last, std::less<_InputType>()); std::inplace_merge(std::forward<_ExecutionPolicy>(__exec), __first, __middle, __last, std::less<_InputType>());
} }
// [includes] // [includes]