#include "execution_impl.h"
#include "memory_impl.h"
+#include "parallel_backend_utils.h"
#include "unseq_backend_simd.h"
#if __PSTL_USE_PAR_POLICIES
__pattern_any_of(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator __last, _Pred __pred,
_IsVector __is_vector, /*parallel=*/std::false_type) noexcept
{
- return __brick_any_of(__first, __last, __pred, __is_vector);
+ return __internal::__brick_any_of(__first, __last, __pred, __is_vector);
}
#if __PSTL_USE_PAR_POLICIES
__pattern_any_of(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Pred __pred,
_IsVector __is_vector, /*parallel=*/std::true_type)
{
- return __except_handler([&]() {
- return __parallel_or(std::forward<_ExecutionPolicy>(__exec), __first, __last,
+ return __internal::__except_handler([&]() {
+ return __internal::__parallel_or(std::forward<_ExecutionPolicy>(__exec), __first, __last,
[__pred, __is_vector](_ForwardIterator __i, _ForwardIterator __j) {
- return __brick_any_of(__i, __j, __pred, __is_vector);
+ return __internal::__brick_any_of(__i, __j, __pred, __is_vector);
});
});
}
_IsVector __is_vector,
/*parallel=*/std::false_type) noexcept
{
- __brick_walk1(__first, __last, __f, __is_vector);
+ __internal::__brick_walk1(__first, __last, __f, __is_vector);
}
#if __PSTL_USE_PAR_POLICIES
_IsVector __is_vector,
/*parallel=*/std::true_type)
{
- __except_handler([&]() {
+ __internal::__except_handler([&]() {
__par_backend::__parallel_for(std::forward<_ExecutionPolicy>(__exec), __first, __last,
[__f, __is_vector](_ForwardIterator __i, _ForwardIterator __j) {
- __brick_walk1(__i, __j, __f, __is_vector);
+ __internal::__brick_walk1(__i, __j, __f, __is_vector);
});
});
}
__pattern_walk_brick(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Brick __brick,
/*parallel=*/std::true_type)
{
- __except_handler([&]() {
+ __internal::__except_handler([&]() {
__par_backend::__parallel_for(std::forward<_ExecutionPolicy>(__exec), __first, __last,
[__brick](_ForwardIterator __i, _ForwardIterator __j) { __brick(__i, __j); });
});
_ForwardIterator
__brick_walk1_n(_ForwardIterator __first, _Size __n, _Function __f, /*_IsVectorTag=*/std::false_type)
{
- return __for_each_n_it_serial(__first, __n,
+ return __internal::__for_each_n_it_serial(__first, __n,
[&__f](_ForwardIterator __it) { __f(*__it); }); // calling serial version
}
__pattern_walk1_n(_ExecutionPolicy&&, _ForwardIterator __first, _Size __n, _Function __f, _IsVector __is_vector,
/*is_parallel=*/std::false_type) noexcept
{
- return __brick_walk1_n(__first, __n, __f, __is_vector);
+ return __internal::__brick_walk1_n(__first, __n, __f, __is_vector);
}
#if __PSTL_USE_PAR_POLICIES
_IsVector __is_vector,
/*is_parallel=*/std::true_type)
{
- __pattern_walk1(std::forward<_ExecutionPolicy>(__exec), __first, __first + __n, __f, __is_vector, std::true_type());
+ __internal::__pattern_walk1(std::forward<_ExecutionPolicy>(__exec), __first, __first + __n, __f, __is_vector, std::true_type());
return __first + __n;
}
#endif
__pattern_walk_brick_n(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _Size __n, _Brick __brick,
/*is_parallel=*/std::true_type)
{
- return __except_handler([&]() {
+ return __internal::__except_handler([&]() {
__par_backend::__parallel_for(
std::forward<_ExecutionPolicy>(__exec), __first, __first + __n,
[__brick](_RandomAccessIterator __i, _RandomAccessIterator __j) { __brick(__i, __j - __i); });
__pattern_walk2(_ExecutionPolicy&&, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
_Function __f, _IsVector __is_vector, /*parallel=*/std::false_type) noexcept
{
- return __brick_walk2(__first1, __last1, __first2, __f, __is_vector);
+ return __internal::__brick_walk2(__first1, __last1, __first2, __f, __is_vector);
}
#if __PSTL_USE_PAR_POLICIES
__pattern_walk2(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _Function __f, _IsVector __is_vector, /*parallel=*/std::true_type)
{
- return __except_handler([&]() {
+ return __internal::__except_handler([&]() {
__par_backend::__parallel_for(
std::forward<_ExecutionPolicy>(__exec), __first1, __last1,
[__f, __first1, __first2, __is_vector](_ForwardIterator1 __i, _ForwardIterator1 __j) {
- __brick_walk2(__i, __j, __first2 + (__i - __first1), __f, __is_vector);
+ __internal::__brick_walk2(__i, __j, __first2 + (__i - __first1), __f, __is_vector);
});
return __first2 + (__last1 - __first1);
});
__pattern_walk2_n(_ExecutionPolicy&&, _ForwardIterator1 __first1, _Size n, _ForwardIterator2 __first2, _Function f,
_IsVector is_vector, /*parallel=*/std::false_type) noexcept
{
- return __brick_walk2_n(__first1, n, __first2, f, is_vector);
+ return __internal::__brick_walk2_n(__first1, n, __first2, f, is_vector);
}
template <class _ExecutionPolicy, class _RandomAccessIterator1, class _Size, class _RandomAccessIterator2,
__pattern_walk2_n(_ExecutionPolicy&& __exec, _RandomAccessIterator1 __first1, _Size n, _RandomAccessIterator2 __first2,
_Function f, _IsVector is_vector, /*parallel=*/std::true_type)
{
- return __pattern_walk2(std::forward<_ExecutionPolicy>(__exec), __first1, __first1 + n, __first2, f, is_vector,
+ return __internal::__pattern_walk2(std::forward<_ExecutionPolicy>(__exec), __first1, __first1 + n, __first2, f, is_vector,
std::true_type());
}
__pattern_walk2_brick(_ExecutionPolicy&& __exec, _RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1,
_RandomAccessIterator2 __first2, _Brick __brick, /*parallel=*/std::true_type)
{
- return __except_handler([&]() {
+ return __internal::__except_handler([&]() {
__par_backend::__parallel_for(
std::forward<_ExecutionPolicy>(__exec), __first1, __last1,
[__first1, __first2, __brick](_RandomAccessIterator1 __i, _RandomAccessIterator1 __j) {
__pattern_walk2_brick_n(_ExecutionPolicy&& __exec, _RandomAccessIterator1 __first1, _Size __n,
_RandomAccessIterator2 __first2, _Brick __brick, /*parallel=*/std::true_type)
{
- return __except_handler([&]() {
+ return __internal::__except_handler([&]() {
__par_backend::__parallel_for(
std::forward<_ExecutionPolicy>(__exec), __first1, __first1 + __n,
[__first1, __first2, __brick](_RandomAccessIterator1 __i, _RandomAccessIterator1 __j) {
__pattern_walk3(_ExecutionPolicy&&, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
_ForwardIterator3 __first3, _Function __f, _IsVector __is_vector, /*parallel=*/std::false_type) noexcept
{
- return __brick_walk3(__first1, __last1, __first2, __first3, __f, __is_vector);
+ return __internal::__brick_walk3(__first1, __last1, __first2, __first3, __f, __is_vector);
}
#if __PSTL_USE_PAR_POLICIES
_RandomAccessIterator2 __first2, _RandomAccessIterator3 __first3, _Function __f, _IsVector __is_vector,
/*parallel=*/std::true_type)
{
- return __except_handler([&]() {
+ return __internal::__except_handler([&]() {
__par_backend::__parallel_for(
std::forward<_ExecutionPolicy>(__exec), __first1, __last1,
[__f, __first1, __first2, __first3, __is_vector](_RandomAccessIterator1 __i, _RandomAccessIterator1 __j) {
- __brick_walk3(__i, __j, __first2 + (__i - __first1), __first3 + (__i - __first1), __f, __is_vector);
+ __internal::__brick_walk3(__i, __j, __first2 + (__i - __first1), __first3 + (__i - __first1), __f, __is_vector);
});
return __first3 + (__last1 - __first1);
});
__pattern_equal(_ExecutionPolicy&&, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
_BinaryPredicate __p, _IsVector __is_vector, /* is_parallel = */ std::false_type) noexcept
{
- return __brick_equal(__first1, __last1, __first2, __p, __is_vector);
+ return __internal::__brick_equal(__first1, __last1, __first2, __p, __is_vector);
}
#if __PSTL_USE_PAR_POLICIES
_RandomAccessIterator2 __first2, _BinaryPredicate __p, _IsVector __is_vector,
/*is_parallel=*/std::true_type)
{
- return __except_handler([&]() {
- return !__parallel_or(
+ return __internal::__except_handler([&]() {
+ return !__internal::__parallel_or(
std::forward<_ExecutionPolicy>(__exec), __first1, __last1,
[__first1, __first2, __p, __is_vector](_RandomAccessIterator1 __i, _RandomAccessIterator1 __j) {
- return !__brick_equal(__i, __j, __first2 + (__i - __first1), __p, __is_vector);
+ return !__internal::__brick_equal(__i, __j, __first2 + (__i - __first1), __p, __is_vector);
});
});
}
_IsVector __is_vector,
/*is_parallel=*/std::false_type) noexcept
{
- return __brick_find_if(__first, __last, __pred, __is_vector);
+ return __internal::__brick_find_if(__first, __last, __pred, __is_vector);
}
#if __PSTL_USE_PAR_POLICIES
_IsVector __is_vector,
/*is_parallel=*/std::true_type)
{
- return __except_handler([&]() {
- return __parallel_find(std::forward<_ExecutionPolicy>(__exec), __first, __last,
+ return __internal::__except_handler([&]() {
+ return __internal::__parallel_find(std::forward<_ExecutionPolicy>(__exec), __first, __last,
[__pred, __is_vector](_ForwardIterator __i, _ForwardIterator __j) {
- return __brick_find_if(__i, __j, __pred, __is_vector);
+ return __internal::__brick_find_if(__i, __j, __pred, __is_vector);
},
std::less<typename std::iterator_traits<_ForwardIterator>::difference_type>(),
/*is_first=*/true);
while (__first != __last && (__global_last - __first >= __n2))
{
// find position of *s_first in [first, last) (it can be start of subsequence)
- __first = __brick_find_if(__first, __last,
+ __first = __internal::__brick_find_if(__first, __last,
__equal_value_by_pred<_ValueType, _BinaryPredicate>(*__s_first, __pred), __is_vector);
// if position that was found previously is the start of subsequence
// then we can exit the loop (b_first == true) or keep the position
// (b_first == false)
if (__first != __last && (__global_last - __first >= __n2) &&
- __brick_equal(__s_first + 1, __s_last, __first + 1, __pred, __is_vector))
+ __internal::__brick_equal(__s_first + 1, __s_last, __first + 1, __pred, __is_vector))
{
if (__b_first)
{
auto __unary_pred = __equal_value_by_pred<_Tp, _BinaryPredicate>(__value, __pred);
while (__first != __last && (__global_last - __first >= __count))
{
- __first = __brick_find_if(__first, __last, __unary_pred, __is_vector);
+ __first = __internal::__brick_find_if(__first, __last, __unary_pred, __is_vector);
// check that all of elements in [first+1, first+count) equal to value
if (__first != __last && (__global_last - __first >= __count) &&
- !__brick_any_of(__first + 1, __first + __count, __not_pred<decltype(__unary_pred)>(__unary_pred),
+ !__internal::__brick_any_of(__first + 1, __first + __count, __not_pred<decltype(__unary_pred)>(__unary_pred),
__is_vector))
{
return __first;
_ForwardIterator2 __s_last, _BinaryPredicate __pred, _IsVector __is_vector,
/*is_parallel=*/std::false_type) noexcept
{
- return __brick_find_end(__first, __last, __s_first, __s_last, __pred, __is_vector);
+ return __internal::__brick_find_end(__first, __last, __s_first, __s_last, __pred, __is_vector);
}
#if __PSTL_USE_PAR_POLICIES
{
if (__last - __first == __s_last - __s_first)
{
- const bool __res = __pattern_equal(std::forward<_ExecutionPolicy>(__exec), __first, __last, __s_first, __pred,
+ const bool __res = __internal::__pattern_equal(std::forward<_ExecutionPolicy>(__exec), __first, __last, __s_first, __pred,
__is_vector, std::true_type());
return __res ? __first : __last;
}
else
{
- return __except_handler([&]() {
- return __parallel_find(
+ return __internal::__except_handler([&]() {
+ return __internal::__parallel_find(
std::forward<_ExecutionPolicy>(__exec), __first, __last,
[__last, __s_first, __s_last, __pred, __is_vector](_ForwardIterator1 __i, _ForwardIterator1 __j) {
- return __find_subrange(__i, __j, __last, __s_first, __s_last, __pred, false, __is_vector);
+ return __internal::__find_subrange(__i, __j, __last, __s_first, __s_last, __pred, false, __is_vector);
},
std::greater<typename std::iterator_traits<_ForwardIterator1>::difference_type>(), /*is_first=*/false);
});
_ForwardIterator2 __s_first, _ForwardIterator2 __s_last, _BinaryPredicate __pred,
_IsVector __is_vector, /*is_parallel=*/std::false_type) noexcept
{
- return __brick_find_first_of(__first, __last, __s_first, __s_last, __pred, __is_vector);
+ return __internal::__brick_find_first_of(__first, __last, __s_first, __s_last, __pred, __is_vector);
}
#if __PSTL_USE_PAR_POLICIES
_ForwardIterator2 __s_first, _ForwardIterator2 __s_last, _BinaryPredicate __pred,
_IsVector __is_vector, /*is_parallel=*/std::true_type) noexcept
{
- return __except_handler([&]() {
- return __parallel_find(
+ return __internal::__except_handler([&]() {
+ return __internal::__parallel_find(
std::forward<_ExecutionPolicy>(__exec), __first, __last,
[__s_first, __s_last, __pred, __is_vector](_ForwardIterator1 __i, _ForwardIterator1 __j) {
- return __brick_find_first_of(__i, __j, __s_first, __s_last, __pred, __is_vector);
+ return __internal::__brick_find_first_of(__i, __j, __s_first, __s_last, __pred, __is_vector);
},
std::less<typename std::iterator_traits<_ForwardIterator1>::difference_type>(), /*is_first=*/true);
});
__brick_search(_ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __s_first,
_ForwardIterator2 __s_last, _BinaryPredicate __pred, /*vector=*/std::true_type) noexcept
{
- return __find_subrange(__first, __last, __last, __s_first, __s_last, __pred, true, std::true_type());
+ return __internal::__find_subrange(__first, __last, __last, __s_first, __s_last, __pred, true, std::true_type());
}
template <class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate,
_ForwardIterator2 __s_last, _BinaryPredicate __pred, _IsVector __is_vector,
/*is_parallel=*/std::false_type) noexcept
{
- return __brick_search(__first, __last, __s_first, __s_last, __pred, __is_vector);
+ return __internal::__brick_search(__first, __last, __s_first, __s_last, __pred, __is_vector);
}
#if __PSTL_USE_PAR_POLICIES
{
if (__last - __first == __s_last - __s_first)
{
- const bool __res = __pattern_equal(std::forward<_ExecutionPolicy>(__exec), __first, __last, __s_first, __pred,
+ const bool __res = __internal::__pattern_equal(std::forward<_ExecutionPolicy>(__exec), __first, __last, __s_first, __pred,
__is_vector, std::true_type());
return __res ? __first : __last;
}
else
{
- return __except_handler([&]() {
- return __parallel_find(
+ return __internal::__except_handler([&]() {
+ return __internal::__parallel_find(
std::forward<_ExecutionPolicy>(__exec), __first, __last,
[__last, __s_first, __s_last, __pred, __is_vector](_ForwardIterator1 __i, _ForwardIterator1 __j) {
- return __find_subrange(__i, __j, __last, __s_first, __s_last, __pred, true, __is_vector);
+ return __internal::__find_subrange(__i, __j, __last, __s_first, __s_last, __pred, true, __is_vector);
},
std::less<typename std::iterator_traits<_ForwardIterator1>::difference_type>(), /*is_first=*/true);
});
__brick_search_n(_ForwardIterator __first, _ForwardIterator __last, _Size __count, const _Tp& __value,
_BinaryPredicate __pred, /*vector=*/std::true_type) noexcept
{
- return __find_subrange(__first, __last, __last, __count, __value, __pred, std::true_type());
+ return __internal::__find_subrange(__first, __last, __last, __count, __value, __pred, std::true_type());
}
template <class _ExecutionPolicy, class _ForwardIterator, class _Size, class _Tp, class _BinaryPredicate,
const _Tp& __value, _BinaryPredicate __pred, _IsVector __is_vector,
/*is_parallel=*/std::false_type) noexcept
{
- return __brick_search_n(__first, __last, __count, __value, __pred, __is_vector);
+ return __internal::__brick_search_n(__first, __last, __count, __value, __pred, __is_vector);
}
#if __PSTL_USE_PAR_POLICIES
if (__last - __first == __count)
{
const bool __result =
- !__pattern_any_of(std::forward<_ExecutionPolicy>(__exec), __first, __last,
+ !__internal::__pattern_any_of(std::forward<_ExecutionPolicy>(__exec), __first, __last,
[&__value, &__pred](const _Tp& __val) { return !__pred(__val, __value); }, __is_vector,
/*is_parallel*/ std::true_type());
return __result ? __first : __last;
}
else
{
- return __except_handler([&__exec, __first, __last, __count, &__value, __pred, __is_vector]() {
- return __parallel_find(
+ return __internal::__except_handler([&__exec, __first, __last, __count, &__value, __pred, __is_vector]() {
+ return __internal::__parallel_find(
std::forward<_ExecutionPolicy>(__exec), __first, __last,
[__last, __count, &__value, __pred, __is_vector](_RandomAccessIterator __i, _RandomAccessIterator __j) {
- return __find_subrange(__i, __j, __last, __count, __value, __pred, __is_vector);
+ return __internal::__find_subrange(__i, __j, __last, __count, __value, __pred, __is_vector);
},
std::less<typename std::iterator_traits<_RandomAccessIterator>::difference_type>(), /*is_first=*/true);
});
#if (__PSTL_MONOTONIC_PRESENT)
__unseq_backend::__simd_copy_by_mask(__first, __last - __first, __result, __mask, __assigner);
#else
- __brick_copy_by_mask(__first, __last, __result, __mask, __assigner, std::false_type());
+ __internal::__brick_copy_by_mask(__first, __last, __result, __mask, __assigner, std::false_type());
#endif
}
#if (__PSTL_MONOTONIC_PRESENT)
__unseq_backend::__simd_partition_by_mask(__first, __last - __first, __out_true, __out_false, __mask);
#else
- __brick_partition_by_mask(__first, __last, __out_true, __out_false, __mask, std::false_type());
+ __internal::__brick_partition_by_mask(__first, __last, __out_true, __out_false, __mask, std::false_type());
#endif
}
__pattern_copy_if(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator __last, _OutputIterator __result,
_UnaryPredicate __pred, _IsVector __is_vector, /*parallel=*/std::false_type) noexcept
{
- return __brick_copy_if(__first, __last, __result, __pred, __is_vector);
+ return __internal::__brick_copy_if(__first, __last, __result, __pred, __is_vector);
}
#if __PSTL_USE_PAR_POLICIES
if (_DifferenceType(1) < __n)
{
__par_backend::__buffer<bool> __mask_buf(__n);
- return __except_handler([&__exec, __n, __first, __result, __is_vector, __pred, &__mask_buf]() {
+ return __internal::__except_handler([&__exec, __n, __first, __result, __is_vector, __pred, &__mask_buf]() {
bool* __mask = __mask_buf.get();
_DifferenceType __m{};
__par_backend::parallel_strict_scan(
std::forward<_ExecutionPolicy>(__exec), __n, _DifferenceType(0),
[=](_DifferenceType __i, _DifferenceType __len) { // Reduce
- return __brick_calc_mask_1<_DifferenceType>(__first + __i, __first + (__i + __len), __mask + __i,
+ return __internal::__brick_calc_mask_1<_DifferenceType>(__first + __i, __first + (__i + __len), __mask + __i,
__pred, __is_vector)
.first;
},
std::plus<_DifferenceType>(), // Combine
[=](_DifferenceType __i, _DifferenceType __len, _DifferenceType __initial) { // Scan
- __brick_copy_by_mask(__first + __i, __first + (__i + __len), __result + __initial, __mask + __i,
+ __internal::__brick_copy_by_mask(__first + __i, __first + (__i + __len), __result + __initial, __mask + __i,
[](_RandomAccessIterator __x, _OutputIterator __z) { *__z = *__x; },
__is_vector);
},
});
}
// trivial sequence - use serial algorithm
- return __brick_copy_if(__first, __last, __result, __pred, __is_vector);
+ return __internal::__brick_copy_if(__first, __last, __result, __pred, __is_vector);
}
#endif
__pattern_count(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred,
/* is_parallel */ std::false_type, _IsVector __is_vector) noexcept
{
- return __brick_count(__first, __last, __pred, __is_vector);
+ return __internal::__brick_count(__first, __last, __pred, __is_vector);
}
#if __PSTL_USE_PAR_POLICIES
/* is_parallel */ std::true_type, _IsVector __is_vector)
{
typedef typename std::iterator_traits<_ForwardIterator>::difference_type _SizeType;
- return __except_handler([&]() {
+ return __internal::__except_handler([&]() {
return __par_backend::__parallel_reduce(
std::forward<_ExecutionPolicy>(__exec), __first, __last, _SizeType(0),
[__pred, __is_vector](_ForwardIterator __begin, _ForwardIterator __end, _SizeType __value) -> _SizeType {
- return __value + __brick_count(__begin, __end, __pred, __is_vector);
+ return __value + __internal::__brick_count(__begin, __end, __pred, __is_vector);
},
std::plus<_SizeType>());
});
__pattern_unique(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred,
_IsVector __is_vector, /*is_parallel=*/std::false_type) noexcept
{
- return __brick_unique(__first, __last, __pred, __is_vector);
+ return __internal::__brick_unique(__first, __last, __pred, __is_vector);
}
#if __PSTL_USE_PAR_POLICIES
// So, a caller passes _CalcMask brick into remove_elements.
template <class _ExecutionPolicy, class _ForwardIterator, class _CalcMask, class _IsVector>
_ForwardIterator
-remove_elements(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _CalcMask __calc_mask,
+__remove_elements(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _CalcMask __calc_mask,
_IsVector __is_vector)
{
typedef typename std::iterator_traits<_ForwardIterator>::difference_type _DifferenceType;
_DifferenceType __n = __last - __first;
__par_backend::__buffer<bool> __mask_buf(__n);
// 1. find a first iterator that should be removed
- return __except_handler([&]() {
+ return __internal::__except_handler([&]() {
bool* __mask = __mask_buf.get();
_DifferenceType __min = __par_backend::__parallel_reduce(
std::forward<_ExecutionPolicy>(__exec), _DifferenceType(0), __n, __n,
}
// find first iterator that should be removed
bool* __result =
- __brick_find_if(__mask + __i, __mask + __j, [](bool __val) { return !__val; }, __is_vector);
+ __internal::__brick_find_if(__mask + __i, __mask + __j, [](bool __val) { return !__val; }, __is_vector);
if (__result - __mask == __j)
{
return __local_min;
__par_backend::parallel_strict_scan(
std::forward<_ExecutionPolicy>(__exec), __n, _DifferenceType(0),
[__mask, __is_vector](_DifferenceType __i, _DifferenceType __len) {
- return __brick_count(__mask + __i, __mask + __i + __len, [](bool __val) { return __val; }, __is_vector);
+ return __internal::__brick_count(__mask + __i, __mask + __i + __len, [](bool __val) { return __val; }, __is_vector);
},
std::plus<_DifferenceType>(),
[=](_DifferenceType __i, _DifferenceType __len, _DifferenceType __initial) {
- __brick_copy_by_mask(__first + __i, __first + __i + __len, __result + __initial, __mask + __i,
+ __internal::__brick_copy_by_mask(__first + __i, __first + __i + __len, __result + __initial, __mask + __i,
[](_ForwardIterator __x, _Tp* __z) {
- __invoke_if_else(std::is_trivial<_Tp>(), [&]() { *__z = std::move(*__x); },
+ __internal::__invoke_if_else(std::is_trivial<_Tp>(), [&]() { *__z = std::move(*__x); },
[&]() { ::new (std::addressof(*__z)) _Tp(std::move(*__x)); });
},
__is_vector);
// 3. Elements from result are moved to [first, last)
__par_backend::__parallel_for(std::forward<_ExecutionPolicy>(__exec), __result, __result + __m,
[__result, __first, __is_vector](_Tp* __i, _Tp* __j) {
- __brick_move(__i, __j, __first + (__i - __result), __is_vector);
+ __internal::__brick_move(__i, __j, __first + (__i - __result), __is_vector);
});
return __first + __m;
});
if (__first + 1 == __last || __first + 2 == __last)
{
// Trivial sequence - use serial algorithm
- return __brick_unique(__first, __last, __pred, __is_vector);
+ return __internal::__brick_unique(__first, __last, __pred, __is_vector);
}
- return remove_elements(
+ return __internal::__remove_elements(
std::forward<_ExecutionPolicy>(__exec), ++__first, __last,
[&__pred, __is_vector](bool* __b, bool* __e, _ForwardIterator __it) {
- __brick_walk3(__b, __e, __it - 1, __it,
+ __internal::__brick_walk3(__b, __e, __it - 1, __it,
[&__pred](bool& __x, _ReferenceType __y, _ReferenceType __z) { __x = !__pred(__y, __z); },
__is_vector);
},
__pattern_unique_copy(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator __last, _OutputIterator __result,
_BinaryPredicate __pred, _IsVector __is_vector, /*parallel=*/std::false_type) noexcept
{
- return __brick_unique_copy(__first, __last, __result, __pred, __is_vector);
+ return __internal::__brick_unique_copy(__first, __last, __result, __pred, __is_vector);
}
template <class _DifferenceType, class _RandomAccessIterator, class _BinaryPredicate>
__par_backend::__buffer<bool> __mask_buf(__n);
if (_DifferenceType(2) < __n)
{
- return __except_handler([&__exec, __n, __first, __result, __pred, __is_vector, &__mask_buf]() {
+ return __internal::__except_handler([&__exec, __n, __first, __result, __pred, __is_vector, &__mask_buf]() {
bool* __mask = __mask_buf.get();
_DifferenceType __m{};
__par_backend::parallel_strict_scan(
++__i;
++__extra;
}
- return __brick_calc_mask_2<_DifferenceType>(__first + __i, __first + (__i + __len),
+ return __internal::__brick_calc_mask_2<_DifferenceType>(__first + __i, __first + (__i + __len),
__mask + __i, __pred, __is_vector) +
__extra;
},
std::plus<_DifferenceType>(), // Combine
[=](_DifferenceType __i, _DifferenceType __len, _DifferenceType __initial) { // Scan
// Phase 2 is same as for __pattern_copy_if
- __brick_copy_by_mask(__first + __i, __first + (__i + __len), __result + __initial, __mask + __i,
+ __internal::__brick_copy_by_mask(__first + __i, __first + (__i + __len), __result + __initial, __mask + __i,
[](_RandomAccessIterator __x, _OutputIterator __z) { *__z = *__x; },
__is_vector);
},
}
}
// trivial sequence - use serial algorithm
- return __brick_unique_copy(__first, __last, __result, __pred, __is_vector);
+ return __internal::__brick_unique_copy(__first, __last, __result, __pred, __is_vector);
}
#endif
_IsVector _is_vector,
/*is_parallel=*/std::false_type) noexcept
{
- __brick_reverse(__first, __last, _is_vector);
+ __internal::__brick_reverse(__first, __last, _is_vector);
}
#if __PSTL_USE_PAR_POLICIES
__par_backend::__parallel_for(
std::forward<_ExecutionPolicy>(__exec), __first, __first + (__last - __first) / 2,
[__is_vector, __first, __last](_BidirectionalIterator __inner_first, _BidirectionalIterator __inner_last) {
- __brick_reverse(__inner_first, __inner_last, __last - (__inner_first - __first), __is_vector);
+ __internal::__brick_reverse(__inner_first, __inner_last, __last - (__inner_first - __first), __is_vector);
});
}
#endif
__pattern_reverse_copy(_ExecutionPolicy&&, _BidirectionalIterator __first, _BidirectionalIterator __last,
_OutputIterator __d_first, _IsVector __is_vector, /*is_parallel=*/std::false_type) noexcept
{
- return __brick_reverse_copy(__first, __last, __d_first, __is_vector);
+ return __internal::__brick_reverse_copy(__first, __last, __d_first, __is_vector);
}
#if __PSTL_USE_PAR_POLICIES
__par_backend::__parallel_for(std::forward<_ExecutionPolicy>(__exec), __first, __last,
[__is_vector, __first, __len, __d_first](_BidirectionalIterator __inner_first,
_BidirectionalIterator __inner_last) {
- __brick_reverse_copy(__inner_first, __inner_last,
+ __internal::__brick_reverse_copy(__inner_first, __inner_last,
__d_first + (__len - (__inner_last - __first)), __is_vector);
});
return __d_first + __len;
__pattern_rotate(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last,
_IsVector __is_vector, /*is_parallel=*/std::false_type) noexcept
{
- return __brick_rotate(__first, __middle, __last, __is_vector);
+ return __internal::__brick_rotate(__first, __middle, __last, __is_vector);
}
#if __PSTL_USE_PAR_POLICIES
if (__m <= __n / 2)
{
__par_backend::__buffer<_Tp> __buf(__n - __m);
- return __except_handler([&__exec, __n, __m, __first, __middle, __last, __is_vector, &__buf]() {
+ return __internal::__except_handler([&__exec, __n, __m, __first, __middle, __last, __is_vector, &__buf]() {
_Tp* __result = __buf.get();
__par_backend::__parallel_for(
std::forward<_ExecutionPolicy>(__exec), __middle, __last,
[__middle, __result, __is_vector](_ForwardIterator __b, _ForwardIterator __e) {
- __brick_uninitialized_move(__b, __e, __result + (__b - __middle), __is_vector);
+ __internal::__brick_uninitialized_move(__b, __e, __result + (__b - __middle), __is_vector);
});
__par_backend::__parallel_for(std::forward<_ExecutionPolicy>(__exec), __first, __middle,
[__last, __middle, __is_vector](_ForwardIterator __b, _ForwardIterator __e) {
- __brick_move(__b, __e, __b + (__last - __middle), __is_vector);
+ __internal::__brick_move(__b, __e, __b + (__last - __middle), __is_vector);
});
__par_backend::__parallel_for(std::forward<_ExecutionPolicy>(__exec), __result, __result + (__n - __m),
[__first, __result, __is_vector](_Tp* __b, _Tp* __e) {
- __brick_move(__b, __e, __first + (__b - __result), __is_vector);
+ __internal::__brick_move(__b, __e, __first + (__b - __result), __is_vector);
});
return __first + (__last - __middle);
else
{
__par_backend::__buffer<_Tp> __buf(__m);
- return __except_handler([&__exec, __n, __m, __first, __middle, __last, __is_vector, &__buf]() {
+ return __internal::__except_handler([&__exec, __n, __m, __first, __middle, __last, __is_vector, &__buf]() {
_Tp* __result = __buf.get();
__par_backend::__parallel_for(std::forward<_ExecutionPolicy>(__exec), __first, __middle,
[__first, __result, __is_vector](_ForwardIterator __b, _ForwardIterator __e) {
- __brick_uninitialized_move(__b, __e, __result + (__b - __first),
+ __internal::__brick_uninitialized_move(__b, __e, __result + (__b - __first),
__is_vector);
});
__par_backend::__parallel_for(std::forward<_ExecutionPolicy>(__exec), __middle, __last,
[__first, __middle, __is_vector](_ForwardIterator __b, _ForwardIterator __e) {
- __brick_move(__b, __e, __first + (__b - __middle), __is_vector);
+ __internal::__brick_move(__b, __e, __first + (__b - __middle), __is_vector);
});
__par_backend::__parallel_for(std::forward<_ExecutionPolicy>(__exec), __result, __result + __m,
[__n, __m, __first, __result, __is_vector](_Tp* __b, _Tp* __e) {
- __brick_move(__b, __e, __first + ((__n - __m) + (__b - __result)),
+ __internal::__brick_move(__b, __e, __first + ((__n - __m) + (__b - __result)),
__is_vector);
});
__brick_rotate_copy(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last,
_OutputIterator __result, /*__is_vector=*/std::true_type) noexcept
{
- _OutputIterator __res = __brick_copy(__middle, __last, __result, std::true_type());
- return __brick_copy(__first, __middle, __res, std::true_type());
+ _OutputIterator __res = __internal::__brick_copy(__middle, __last, __result, std::true_type());
+ return __internal::__brick_copy(__first, __middle, __res, std::true_type());
}
template <class _ExecutionPolicy, class _ForwardIterator, class _OutputIterator, class _IsVector>
__pattern_rotate_copy(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last,
_OutputIterator __result, _IsVector __is_vector, /*is_parallel=*/std::false_type) noexcept
{
- return __brick_rotate_copy(__first, __middle, __last, __result, __is_vector);
+ return __internal::__brick_rotate_copy(__first, __middle, __last, __result, __is_vector);
}
#if __PSTL_USE_PAR_POLICIES
[__first, __last, __middle, __result, __is_vector](_ForwardIterator __b, _ForwardIterator __e) {
if (__b > __middle)
{
- __brick_copy(__b, __e, __result + (__b - __middle), __is_vector);
+ __internal::__brick_copy(__b, __e, __result + (__b - __middle), __is_vector);
}
else
{
_OutputIterator __new_result = __result + ((__last - __middle) + (__b - __first));
if (__e < __middle)
{
- __brick_copy(__b, __e, __new_result, __is_vector);
+ __internal::__brick_copy(__b, __e, __new_result, __is_vector);
}
else
{
- __brick_copy(__b, __middle, __new_result, __is_vector);
- __brick_copy(__middle, __e, __result, __is_vector);
+ __internal::__brick_copy(__b, __middle, __new_result, __is_vector);
+ __internal::__brick_copy(__middle, __e, __result, __is_vector);
}
}
});
__pattern_is_partitioned(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator __last, _UnaryPredicate __pred,
_IsVector __is_vector, /*is_parallel=*/std::false_type) noexcept
{
- return __brick_is_partitioned(__first, __last, __pred, __is_vector);
+ return __internal::__brick_is_partitioned(__first, __last, __pred, __is_vector);
}
#if __PSTL_USE_PAR_POLICIES
}
else
{
- return __except_handler([&]() {
+ return __internal::__except_handler([&]() {
// State of current range:
// broken - current range is not partitioned by pred
// all_true - all elements in current range satisfy pred
{
// find first element that don't satisfy pred
_ForwardIterator __x =
- __brick_find_if(__i + 1, __j, __not_pred<_UnaryPredicate>(__pred), __is_vector);
-
+ __internal::__brick_find_if(__i + 1, __j, __not_pred<_UnaryPredicate>(__pred), __is_vector);
if (__x != __j)
{
// find first element after "x" that satisfy pred
- _ForwardIterator __y = __brick_find_if(__x + 1, __j, __pred, __is_vector);
+ _ForwardIterator __y = __internal::__brick_find_if(__x + 1, __j, __pred, __is_vector);
// if it was found then range isn't partitioned by pred
if (__y != __j)
{
{ // if first element doesn't satisfy pred
// then we should find the first element that satisfy pred.
// If we found it then range isn't partitioned by pred
- if (__brick_find_if(__i + 1, __j, __pred, __is_vector) != __j)
+ if (__internal::__brick_find_if(__i + 1, __j, __pred, __is_vector) != __j)
{
return __broken;
}
__pattern_partition(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator __last, _UnaryPredicate __pred,
_IsVector __is_vector, /*is_parallel=*/std::false_type) noexcept
{
- return __brick_partition(__first, __last, __pred, __is_vector);
+ return __internal::__brick_partition(__first, __last, __pred, __is_vector);
}
#if __PSTL_USE_PAR_POLICIES
_ForwardIterator __end;
};
- return __except_handler([&]() {
+ return __internal::__except_handler([&]() {
_PartitionRange __init{__last, __last, __last};
// lambda for merging two partitioned ranges to one partitioned range
__par_backend::__parallel_for(
std::forward<_ExecutionPolicy>(__exec), __val1.__pivot, __val1.__pivot + __size1,
[__val1, __val2, __size1, __is_vector](_ForwardIterator __i, _ForwardIterator __j) {
- __brick_swap_ranges(__i, __j, (__val2.__pivot - __size1) + (__i - __val1.__pivot), __is_vector);
+ __internal::__brick_swap_ranges(__i, __j, (__val2.__pivot - __size1) + (__i - __val1.__pivot), __is_vector);
});
return {__new_begin, __val2.__pivot - __size1, __val2.__end};
}
__par_backend::__parallel_for(
std::forward<_ExecutionPolicy>(__exec), __val1.__pivot, __val1.__pivot + __size2,
[__val1, __val2, __is_vector](_ForwardIterator __i, _ForwardIterator __j) {
- __brick_swap_ranges(__i, __j, __val2.__begin + (__i - __val1.__pivot), __is_vector);
+ __internal::__brick_swap_ranges(__i, __j, __val2.__begin + (__i - __val1.__pivot), __is_vector);
});
return {__new_begin, __val1.__pivot + __size2, __val2.__end};
}
[__pred, __is_vector, __reductor](_ForwardIterator __i, _ForwardIterator __j,
_PartitionRange __value) -> _PartitionRange {
//1. serial partition
- _ForwardIterator __pivot = __brick_partition(__i, __j, __pred, __is_vector);
+ _ForwardIterator __pivot = __internal::__brick_partition(__i, __j, __pred, __is_vector);
// 2. merging of two ranges (left and right respectively)
return __reductor(__value, {__i, __pivot, __j});
_UnaryPredicate __pred, _IsVector __is_vector,
/*is_parallelization=*/std::false_type) noexcept
{
- return __brick_stable_partition(__first, __last, __pred, __is_vector);
+ return __internal::__brick_stable_partition(__first, __last, __pred, __is_vector);
}
#if __PSTL_USE_PAR_POLICIES
_BidirectionalIterator __end;
};
- return __except_handler([&]() {
+ return __internal::__except_handler([&]() {
_PartitionRange __init{__last, __last, __last};
// lambda for merging two partitioned ranges to one partitioned range
// then we should swap the false part of left range and last part of true part of right range
else
{
- __brick_rotate(__val1.__pivot, __val2.__begin, __val2.__pivot, __is_vector);
+ __internal::__brick_rotate(__val1.__pivot, __val2.__begin, __val2.__pivot, __is_vector);
return {__new_begin, __val2.__pivot - __size1, __val2.__end};
}
};
[&__pred, __is_vector, __reductor](_BidirectionalIterator __i, _BidirectionalIterator __j,
_PartitionRange __value) -> _PartitionRange {
//1. serial stable_partition
- _BidirectionalIterator __pivot = __brick_stable_partition(__i, __j, __pred, __is_vector);
+ _BidirectionalIterator __pivot = __internal::__brick_stable_partition(__i, __j, __pred, __is_vector);
// 2. merging of two ranges (left and right respectively)
return __reductor(__value, {__i, __pivot, __j});
_OutputIterator1 __out_true, _OutputIterator2 __out_false, _UnaryPredicate __pred,
_IsVector __is_vector, /*is_parallelization=*/std::false_type) noexcept
{
- return __brick_partition_copy(__first, __last, __out_true, __out_false, __pred, __is_vector);
+ return __internal::__brick_partition_copy(__first, __last, __out_true, __out_false, __pred, __is_vector);
}
#if __PSTL_USE_PAR_POLICIES
if (_DifferenceType(1) < __n)
{
__par_backend::__buffer<bool> __mask_buf(__n);
- return __except_handler([&__exec, __n, __first, __out_true, __out_false, __is_vector, __pred, &__mask_buf]() {
+ return __internal::__except_handler([&__exec, __n, __first, __out_true, __out_false, __is_vector, __pred, &__mask_buf]() {
bool* __mask = __mask_buf.get();
_ReturnType __m{};
__par_backend::parallel_strict_scan(
std::forward<_ExecutionPolicy>(__exec), __n, std::make_pair(_DifferenceType(0), _DifferenceType(0)),
[=](_DifferenceType __i, _DifferenceType __len) { // Reduce
- return __brick_calc_mask_1<_DifferenceType>(__first + __i, __first + (__i + __len), __mask + __i,
+ return __internal::__brick_calc_mask_1<_DifferenceType>(__first + __i, __first + (__i + __len), __mask + __i,
__pred, __is_vector);
},
[](const _ReturnType& __x, const _ReturnType& __y) -> _ReturnType {
return std::make_pair(__x.first + __y.first, __x.second + __y.second);
}, // Combine
[=](_DifferenceType __i, _DifferenceType __len, _ReturnType __initial) { // Scan
- __brick_partition_by_mask(__first + __i, __first + (__i + __len), __out_true + __initial.first,
+ __internal::__brick_partition_by_mask(__first + __i, __first + (__i + __len), __out_true + __initial.first,
__out_false + __initial.second, __mask + __i, __is_vector);
},
[&__m](_ReturnType __total) { __m = __total; });
});
}
// trivial sequence - use serial algorithm
- return __brick_partition_copy(__first, __last, __out_true, __out_false, __pred, __is_vector);
+ return __internal::__brick_partition_copy(__first, __last, __out_true, __out_false, __pred, __is_vector);
}
#endif
__pattern_sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp,
_IsVector /*is_vector*/, /*is_parallel=*/std::true_type, /*is_move_constructible=*/std::true_type)
{
- __except_handler([&]() {
+ __internal::__except_handler([&]() {
__par_backend::__parallel_stable_sort(std::forward<_ExecutionPolicy>(__exec), __first, __last, __comp,
[](_RandomAccessIterator __first, _RandomAccessIterator __last,
_Compare __comp) { std::sort(__first, __last, __comp); },
__pattern_stable_sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last,
_Compare __comp, _IsVector /*is_vector*/, /*is_parallel=*/std::true_type)
{
- __except_handler([&]() {
+ __internal::__except_handler([&]() {
__par_backend::__parallel_stable_sort(std::forward<_ExecutionPolicy>(__exec), __first, __last, __comp,
[](_RandomAccessIterator __first, _RandomAccessIterator __last,
_Compare __comp) { std::stable_sort(__first, __last, __comp); });
_RandomAccessIterator __last, _Compare __comp, _IsVector, /*is_parallel=*/std::true_type)
{
const auto __n = __middle - __first;
- __except_handler([&]() {
+ __internal::__except_handler([&]() {
__par_backend::__parallel_stable_sort(
std::forward<_ExecutionPolicy>(__exec), __first, __last, __comp,
[__n](_RandomAccessIterator __begin, _RandomAccessIterator __end, _Compare __comp) {
}
auto __n1 = __last - __first;
auto __n2 = __d_last - __d_first;
- return __except_handler([&]() {
+ return __internal::__except_handler([&]() {
if (__n2 >= __n1)
{
__par_backend::__parallel_stable_sort(
// 1. Copy elements from input to output
#if !__PSTL_ICC_18_OMP_SIMD_BROKEN
- __brick_copy(__i1, __j1, __i, __is_vector);
+ __internal::__brick_copy(__i1, __j1, __i, __is_vector);
#else
std::copy(__i1, __j1, __i);
#endif
// 3. Move elements from temporary __buffer to output
__par_backend::__parallel_for(std::forward<_ExecutionPolicy>(__exec), __r, __r + __n2,
[__r, __d_first, __is_vector](_T1* __i, _T1* __j) {
- __brick_move(__i, __j, __d_first + (__i - __r), __is_vector);
+ __internal::__brick_move(__i, __j, __d_first + (__i - __r), __is_vector);
});
return __d_first + __n2;
}
__pattern_adjacent_find(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred,
/* is_parallel */ std::false_type, _IsVector __is_vector, bool __or_semantic) noexcept
{
- return __brick_adjacent_find(__first, __last, __pred, __is_vector, __or_semantic);
+ return __internal::__brick_adjacent_find(__first, __last, __pred, __is_vector, __or_semantic);
}
#if __PSTL_USE_PAR_POLICIES
if (__last - __first < 2)
return __last;
- return __except_handler([&]() {
+ return __internal::__except_handler([&]() {
return __par_backend::__parallel_reduce(
std::forward<_ExecutionPolicy>(__exec), __first, __last, __last,
[__last, __pred, __is_vector, __or_semantic](_RandomAccessIterator __begin, _RandomAccessIterator __end,
//correct the global result iterator if the "brick" returns a local "__last"
const _RandomAccessIterator __res =
- __brick_adjacent_find(__begin, __end, __pred, __is_vector, __or_semantic);
+ __internal::__brick_adjacent_find(__begin, __end, __pred, __is_vector, __or_semantic);
if (__res < __end)
__value = __res;
}
_RandomAccessIterator __x;
do
{
- __x = __pattern_partition(std::forward<_ExecutionPolicy>(__exec), __first + 1, __last,
+ __x = __internal::__pattern_partition(std::forward<_ExecutionPolicy>(__exec), __first + 1, __last,
[&__comp, __first](const _Tp& __x) { return __comp(__x, *__first); }, __is_vector,
/*is_parallel=*/std::true_type());
--__x;
__pattern_fill(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value,
/*is_parallel=*/std::false_type, _IsVector __is_vector) noexcept
{
- __brick_fill(__first, __last, __value, __is_vector);
+ __internal::__brick_fill(__first, __last, __value, __is_vector);
}
#if __PSTL_USE_PAR_POLICIES
__pattern_fill(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value,
/*is_parallel=*/std::true_type, _IsVector __is_vector)
{
- return __except_handler([&__exec, __first, __last, &__value, __is_vector]() {
+ return __internal::__except_handler([&__exec, __first, __last, &__value, __is_vector]() {
__par_backend::__parallel_for(std::forward<_ExecutionPolicy>(__exec), __first, __last,
[&__value, __is_vector](_ForwardIterator __begin, _ForwardIterator __end) {
- __brick_fill(__begin, __end, __value, __is_vector);
+ __internal::__brick_fill(__begin, __end, __value, __is_vector);
});
return __last;
});
__pattern_fill_n(_ExecutionPolicy&&, _OutputIterator __first, _Size __count, const _Tp& __value,
/*is_parallel=*/std::false_type, _IsVector __is_vector) noexcept
{
- return __brick_fill_n(__first, __count, __value, __is_vector);
+ return __internal::__brick_fill_n(__first, __count, __value, __is_vector);
}
template <class _ExecutionPolicy, class _OutputIterator, class _Size, class _Tp, class _IsVector>
__pattern_fill_n(_ExecutionPolicy&& __exec, _OutputIterator __first, _Size __count, const _Tp& __value,
/*is_parallel=*/std::true_type, _IsVector __is_vector)
{
- return __pattern_fill(std::forward<_ExecutionPolicy>(__exec), __first, __first + __count, __value, std::true_type(),
+ return __internal::__pattern_fill(std::forward<_ExecutionPolicy>(__exec), __first, __first + __count, __value, std::true_type(),
__is_vector);
}
__pattern_generate(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator __last, _Generator __g,
/*is_parallel=*/std::false_type, _IsVector __is_vector) noexcept
{
- __brick_generate(__first, __last, __g, __is_vector);
+ __internal::__brick_generate(__first, __last, __g, __is_vector);
}
#if __PSTL_USE_PAR_POLICIES
__pattern_generate(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Generator __g,
/*is_parallel=*/std::true_type, _IsVector __is_vector)
{
- return __except_handler([&]() {
+ return __internal::__except_handler([&]() {
__par_backend::__parallel_for(std::forward<_ExecutionPolicy>(__exec), __first, __last,
[__g, __is_vector](_ForwardIterator __begin, _ForwardIterator __end) {
- __brick_generate(__begin, __end, __g, __is_vector);
+ __internal::__brick_generate(__begin, __end, __g, __is_vector);
});
return __last;
});
__pattern_generate_n(_ExecutionPolicy&&, _OutputIterator __first, _Size __count, _Generator __g,
/*is_parallel=*/std::false_type, _IsVector __is_vector) noexcept
{
- return __brick_generate_n(__first, __count, __g, __is_vector);
+ return __internal::__brick_generate_n(__first, __count, __g, __is_vector);
}
#if __PSTL_USE_PAR_POLICIES
{
static_assert(__is_random_access_iterator<_OutputIterator>::value,
"Pattern-brick error. Should be a random access iterator.");
- return __pattern_generate(std::forward<_ExecutionPolicy>(__exec), __first, __first + __count, __g, std::true_type(),
+ return __internal::__pattern_generate(std::forward<_ExecutionPolicy>(__exec), __first, __first + __count, __g, std::true_type(),
__is_vector);
}
#endif
__pattern_remove_if(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator __last, _UnaryPredicate __pred,
_IsVector __is_vector, /*is_parallel*/ std::false_type) noexcept
{
- return __brick_remove_if(__first, __last, __pred, __is_vector);
+ return __internal::__brick_remove_if(__first, __last, __pred, __is_vector);
}
#if __PSTL_USE_PAR_POLICIES
if (__first == __last || __first + 1 == __last)
{
// Trivial sequence - use serial algorithm
- return __brick_remove_if(__first, __last, __pred, __is_vector);
+ return __internal::__brick_remove_if(__first, __last, __pred, __is_vector);
}
- return remove_elements(std::forward<_ExecutionPolicy>(__exec), __first, __last,
+ return __internal::__remove_elements(std::forward<_ExecutionPolicy>(__exec), __first, __last,
[&__pred, __is_vector](bool* __b, bool* __e, _ForwardIterator __it) {
- __brick_walk2(__b, __e, __it,
+ __internal::__brick_walk2(__b, __e, __it,
[&__pred](bool& __x, _ReferenceType __y) { __x = !__pred(__y); },
__is_vector);
},
_ForwardIterator2 __last2, _OutputIterator __d_first, _Compare __comp, _IsVector __is_vector,
/* is_parallel = */ std::false_type) noexcept
{
- return __brick_merge(__first1, __last1, __first2, __last2, __d_first, __comp, __is_vector);
+ return __internal::__brick_merge(__first1, __last1, __first2, __last2, __d_first, __comp, __is_vector);
}
#if __PSTL_USE_PAR_POLICIES
std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __first2, __last2, __d_first, __comp,
[__is_vector](_RandomAccessIterator1 __f1, _RandomAccessIterator1 __l1, _RandomAccessIterator2 __f2,
_RandomAccessIterator2 __l2, _OutputIterator __f3,
- _Compare __comp) { return __brick_merge(__f1, __l1, __f2, __l2, __f3, __comp, __is_vector); });
+ _Compare __comp) { return __internal::__brick_merge(__f1, __l1, __f2, __l2, __f3, __comp, __is_vector); });
return __d_first + (__last1 - __first1) + (__last2 - __first2);
}
#endif
_BidirectionalIterator __last, _Compare __comp, _IsVector __is_vector,
/* is_parallel = */ std::false_type) noexcept
{
- __brick_inplace_merge(__first, __middle, __last, __comp, __is_vector);
+ __internal::__brick_inplace_merge(__first, __middle, __last, __comp, __is_vector);
}
#if __PSTL_USE_PAR_POLICIES
auto __n = __last - __first;
__par_backend::__buffer<_Tp> __buf(__n);
_Tp* __r = __buf.get();
- __except_handler([&]() {
+ __internal::__except_handler([&]() {
auto __move_values = [](_BidirectionalIterator __x, _Tp* __z) {
- __invoke_if_else(std::is_trivial<_Tp>(), [&]() { *__z = std::move(*__x); },
- [&]() { ::new (std::addressof(*__z)) _Tp(std::move(*__x)); });
+ __internal::__invoke_if_else(std::is_trivial<_Tp>(), [&]() { *__z = std::move(*__x); },
+ [&]() { ::new (std::addressof(*__z)) _Tp(std::move(*__x)); });
};
auto __move_sequences = [](_BidirectionalIterator __first1, _BidirectionalIterator __last1, _Tp* __first2) {
- return __brick_uninitialized_move(__first1, __last1, __first2, _IsVector());
+ return __internal::__brick_uninitialized_move(__first1, __last1, __first2, _IsVector());
};
__par_backend::__parallel_merge(
__func(__f1, __l1, __f2, __l2, __f3, __comp);
return __f3 + (__l1 - __f1) + (__l2 - __f2);
});
+
__par_backend::__parallel_for(std::forward<_ExecutionPolicy>(__exec), __r, __r + __n,
[__r, __first, __is_vector](_Tp* __i, _Tp* __j) {
- __brick_move(__i, __j, __first + (__i - __r), __is_vector);
+ __internal::__brick_move(__i, __j, __first + (__i - __r), __is_vector);
});
});
}
if (__last2 - __first2 == 1)
return !__comp(*__first1, *__first2) && !__comp(*__first2, *__first1);
- return __except_handler([&]() {
- return !__parallel_or(
+ return __internal::__except_handler([&]() {
+ return !__internal::__parallel_or(
std::forward<_ExecutionPolicy>(__exec), __first2, __last2,
[__first1, __last1, __first2, __last2, &__comp](_ForwardIterator2 __i, _ForwardIterator2 __j) {
assert(__j > __i);
__par_backend::__buffer<_T> __buf(__size_func(__n1, __n2));
- return __except_handler([&__exec, __n1, __first1, __last1, __first2, __last2, __result, __is_vector, __comp,
+ return __internal::__except_handler([&__exec, __n1, __first1, __last1, __first2, __last2, __result, __is_vector, __comp,
__size_func, __set_op, &__buf]() {
auto __buffer = __buf.get();
_DifferenceType __m{};
auto __scan = [=](_DifferenceType, _DifferenceType, const _SetRange& __s) { // Scan
if (!__s.empty())
- __brick_move(__buffer + __s.__buf_pos, __buffer + (__s.__buf_pos + __s.__len), __result + __s.__pos,
+ __internal::__brick_move(__buffer + __s.__buf_pos, __buffer + (__s.__buf_pos + __s.__len), __result + __s.__pos,
__is_vector);
};
__par_backend::parallel_strict_scan(
const auto __n2 = __last2 - __first2;
auto copy_range1 = [__is_vector](_ForwardIterator1 __begin, _ForwardIterator1 __end, _OutputIterator __res) {
- return __brick_copy(__begin, __end, __res, __is_vector);
+ return __internal::__brick_copy(__begin, __end, __res, __is_vector);
};
auto copy_range2 = [__is_vector](_ForwardIterator2 __begin, _ForwardIterator2 __end, _OutputIterator __res) {
- return __brick_copy(__begin, __end, __res, __is_vector);
+ return __internal::__brick_copy(__begin, __end, __res, __is_vector);
};
// {1} {}: parallel copying just first sequence
if (__n2 == 0)
- return __pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __result, copy_range1,
+ return __internal::__pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __result, copy_range1,
std::true_type());
// {} {2}: parallel copying justmake second sequence
if (__n1 == 0)
- return __pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first2, __last2, __result, copy_range2,
+ return __internal::__pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first2, __last2, __result, copy_range2,
std::true_type());
// testing whether the sequences are intersected
- _ForwardIterator1 __left_bound_seq_1 = lower_bound(__first1, __last1, *__first2, __comp);
+ _ForwardIterator1 __left_bound_seq_1 = std::lower_bound(__first1, __last1, *__first2, __comp);
if (__left_bound_seq_1 == __last1)
{
//{1} < {2}: seq2 is wholly greater than seq1, so, do parallel copying seq1 and seq2
__par_backend::__parallel_invoke(std::forward<_ExecutionPolicy>(__exec),
[=] {
- __pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first1,
+ __internal::__pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first1,
__last1, __result, copy_range1, std::true_type());
},
[=] {
- __pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first2,
+ __internal::__pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first2,
__last2, __result + __n1, copy_range2,
std::true_type());
});
}
// testing whether the sequences are intersected
- _ForwardIterator2 __left_bound_seq_2 = lower_bound(__first2, __last2, *__first1, __comp);
+ _ForwardIterator2 __left_bound_seq_2 = std::lower_bound(__first2, __last2, *__first1, __comp);
if (__left_bound_seq_2 == __last2)
{
//{2} < {1}: seq2 is wholly greater than seq1, so, do parallel copying seq1 and seq2
__par_backend::__parallel_invoke(std::forward<_ExecutionPolicy>(__exec),
[=] {
- __pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first2,
+ __internal::__pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first2,
__last2, __result, copy_range2, std::true_type());
},
[=] {
- __pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first1,
+ __internal::__pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first1,
__last1, __result + __n2, copy_range1,
std::true_type());
});
std::forward<_ExecutionPolicy>(__exec),
//do parallel copying of [first1; left_bound_seq_1)
[=] {
- __pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first1, __left_bound_seq_1, __res_or,
+ __internal::__pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first1, __left_bound_seq_1, __res_or,
copy_range1, std::true_type());
},
[=, &__result] {
- __result = __parallel_set_op(std::forward<_ExecutionPolicy>(__exec), __left_bound_seq_1, __last1,
+ __result = __internal::__parallel_set_op(std::forward<_ExecutionPolicy>(__exec), __left_bound_seq_1, __last1,
__first2, __last2, __result, __comp,
[](_DifferenceType __n, _DifferenceType __m) { return __n + __m; },
__set_union_op, __is_vector);
std::forward<_ExecutionPolicy>(__exec),
//do parallel copying of [first2; left_bound_seq_2)
[=] {
- __pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first2, __left_bound_seq_2, __res_or,
+ __internal::__pattern_walk2_brick(std::forward<_ExecutionPolicy>(__exec), __first2, __left_bound_seq_2, __res_or,
copy_range2, std::true_type());
},
[=, &__result] {
- __result = __parallel_set_op(std::forward<_ExecutionPolicy>(__exec), __first1, __last1,
+ __result = __internal::__parallel_set_op(std::forward<_ExecutionPolicy>(__exec), __first1, __last1,
__left_bound_seq_2, __last2, __result, __comp,
[](_DifferenceType __n, _DifferenceType __m) { return __n + __m; },
__set_union_op, __is_vector);
return __result;
}
- return __parallel_set_op(std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __first2, __last2, __result,
+ return __internal::__parallel_set_op(std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __first2, __last2, __result,
__comp, [](_DifferenceType __n, _DifferenceType __m) { return __n + __m; }, __set_union_op,
__is_vector);
}
_IsVector __is_vector,
/*is_parallel=*/std::false_type) noexcept
{
- return __brick_set_union(__first1, __last1, __first2, __last2, __result, __comp, __is_vector);
+ return __internal::__brick_set_union(__first1, __last1, __first2, __last2, __result, __comp, __is_vector);
}
#if __PSTL_USE_PAR_POLICIES
return std::set_union(__first1, __last1, __first2, __last2, __result, __comp);
typedef typename std::iterator_traits<_OutputIterator>::value_type _T;
- return __parallel_set_union_op(std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __first2, __last2, __result,
+ return __internal::__parallel_set_union_op(std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __first2, __last2, __result,
__comp,
[](_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
_ForwardIterator2 __last2, _T* __result, _Compare __comp) {
_ForwardIterator2 __first2, _ForwardIterator2 __last2, _OutputIterator __result,
_Compare __comp, _IsVector __is_vector, /*is_parallel=*/std::false_type) noexcept
{
- return __brick_set_intersection(__first1, __last1, __first2, __last2, __result, __comp, __is_vector);
+ return __internal::__brick_set_intersection(__first1, __last1, __first2, __last2, __result, __comp, __is_vector);
}
#if __PSTL_USE_PAR_POLICIES
return __result;
// testing whether the sequences are intersected
- _ForwardIterator1 __left_bound_seq_1 = lower_bound(__first1, __last1, *__first2, __comp);
+ _ForwardIterator1 __left_bound_seq_1 = std::lower_bound(__first1, __last1, *__first2, __comp);
//{1} < {2}: seq 2 is wholly greater than seq 1, so, the intersection is empty
if (__left_bound_seq_1 == __last1)
return __result;
// testing whether the sequences are intersected
- _ForwardIterator2 __left_bound_seq_2 = lower_bound(__first2, __last2, *__first1, __comp);
+ _ForwardIterator2 __left_bound_seq_2 = std::lower_bound(__first2, __last2, *__first1, __comp);
//{2} < {1}: seq 1 is wholly greater than seq 2, so, the intersection is empty
if (__left_bound_seq_2 == __last2)
return __result;
if (__m1 > __set_algo_cut_off)
{
//we know proper offset due to [first1; left_bound_seq_1) < [first2; last2)
- return __parallel_set_op(
+ return __internal::__parallel_set_op(
std::forward<_ExecutionPolicy>(__exec), __left_bound_seq_1, __last1, __first2, __last2, __result, __comp,
[](_DifferenceType __n, _DifferenceType __m) { return std::min(__n, __m); },
[](_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
if (__m2 > __set_algo_cut_off)
{
//we know proper offset due to [first2; left_bound_seq_2) < [first1; last1)
- __result = __parallel_set_op(
+ __result = __internal::__parallel_set_op(
std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __left_bound_seq_2, __last2, __result, __comp,
[](_DifferenceType __n, _DifferenceType __m) { return std::min(__n, __m); },
[](_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
_ForwardIterator2 __first2, _ForwardIterator2 __last2, _OutputIterator __result,
_Compare __comp, _IsVector __is_vector, /*is_parallel=*/std::false_type) noexcept
{
- return __brick_set_difference(__first1, __last1, __first2, __last2, __result, __comp, __is_vector);
+ return __internal::__brick_set_difference(__first1, __last1, __first2, __last2, __result, __comp, __is_vector);
}
#if __PSTL_USE_PAR_POLICIES
// {1} \ {}: parallel copying just first sequence
if (__n2 == 0)
- return __pattern_walk2_brick(
+ return __internal::__pattern_walk2_brick(
std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __result,
[__is_vector](_ForwardIterator1 __begin, _ForwardIterator1 __end, _OutputIterator __res) {
- return __brick_copy(__begin, __end, __res, __is_vector);
+ return __internal::__brick_copy(__begin, __end, __res, __is_vector);
},
std::true_type());
// testing whether the sequences are intersected
- _ForwardIterator1 __left_bound_seq_1 = lower_bound(__first1, __last1, *__first2, __comp);
+ _ForwardIterator1 __left_bound_seq_1 = std::lower_bound(__first1, __last1, *__first2, __comp);
//{1} < {2}: seq 2 is wholly greater than seq 1, so, parallel copying just first sequence
if (__left_bound_seq_1 == __last1)
- return __pattern_walk2_brick(
+ return __internal::__pattern_walk2_brick(
std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __result,
[__is_vector](_ForwardIterator1 __begin, _ForwardIterator1 __end, _OutputIterator __res) {
- return __brick_copy(__begin, __end, __res, __is_vector);
+ return __internal::__brick_copy(__begin, __end, __res, __is_vector);
},
std::true_type());
// testing whether the sequences are intersected
- _ForwardIterator2 __left_bound_seq_2 = lower_bound(__first2, __last2, *__first1, __comp);
+ _ForwardIterator2 __left_bound_seq_2 = std::lower_bound(__first2, __last2, *__first1, __comp);
//{2} < {1}: seq 1 is wholly greater than seq 2, so, parallel copying just first sequence
if (__left_bound_seq_2 == __last2)
- return __pattern_walk2_brick(
+ return __internal::__pattern_walk2_brick(
std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __result,
[__is_vector](_ForwardIterator1 __begin, _ForwardIterator1 __end, _OutputIterator __res) {
- return __brick_copy(__begin, __end, __res, __is_vector);
+ return __internal::__brick_copy(__begin, __end, __res, __is_vector);
},
std::true_type());
if (__n1 + __n2 > __set_algo_cut_off)
- return __parallel_set_op(std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __first2, __last2, __result,
+ return __internal::__parallel_set_op(std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __first2, __last2, __result,
__comp, [](_DifferenceType __n, _DifferenceType __m) { return __n; },
[](_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
_ForwardIterator2 __last2, _T* __result, _Compare __comp) {
_ForwardIterator2 __first2, _ForwardIterator2 __last2, _OutputIterator __result,
_Compare __comp, _IsVector __is_vector, /*is_parallel=*/std::false_type) noexcept
{
- return __brick_set_symmetric_difference(__first1, __last1, __first2, __last2, __result, __comp, __is_vector);
+ return __internal::__brick_set_symmetric_difference(__first1, __last1, __first2, __last2, __result, __comp, __is_vector);
}
#if __PSTL_USE_PAR_POLICIES
return std::set_symmetric_difference(__first1, __last1, __first2, __last2, __result, __comp);
typedef typename std::iterator_traits<_OutputIterator>::value_type _T;
- return __parallel_set_union_op(
+ return __internal::__parallel_set_union_op(
std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __first2, __last2, __result, __comp,
[](_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2,
_T* __result, _Compare __comp) {
__pattern_is_heap_until(_ExecutionPolicy&&, _RandomAccessIterator __first, _RandomAccessIterator __last,
_Compare __comp, _IsVector __is_vector, /* is_parallel = */ std::false_type) noexcept
{
- return __brick_is_heap_until(__first, __last, __comp, __is_vector);
+ return __internal::__brick_is_heap_until(__first, __last, __comp, __is_vector);
}
template <class _RandomAccessIterator, class _DifferenceType, class _Compare>
if (__last - __first < 2)
return __last;
- return __except_handler([&]() {
+ return __internal::__except_handler([&]() {
return __parallel_find(
std::forward<_ExecutionPolicy>(__exec), __first, __last,
[__first, __comp, __is_vector](_RandomAccessIterator __i, _RandomAccessIterator __j) {
- return __is_heap_until_local(__first, __i - __first, __j - __first, __comp, __is_vector);
+ return __internal::__is_heap_until_local(__first, __i - __first, __j - __first, __comp, __is_vector);
},
std::less<typename std::iterator_traits<_RandomAccessIterator>::difference_type>(), /*is_first=*/true);
});
__pattern_min_element(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator __last, _Compare __comp,
_IsVector __is_vector, /* is_parallel = */ std::false_type) noexcept
{
- return __brick_min_element(__first, __last, __comp, __is_vector);
+ return __internal::__brick_min_element(__first, __last, __comp, __is_vector);
}
#if __PSTL_USE_PAR_POLICIES
if (__first == __last)
return __last;
- return __except_handler([&]() {
+ return __internal::__except_handler([&]() {
return __par_backend::__parallel_reduce(
std::forward<_ExecutionPolicy>(__exec), __first + 1, __last, __first,
[=](_RandomAccessIterator __begin, _RandomAccessIterator __end,
_RandomAccessIterator __init) -> _RandomAccessIterator {
- const _RandomAccessIterator subresult = __brick_min_element(__begin, __end, __comp, __is_vector);
- return __cmp_iterators_by_values(__init, subresult, __comp);
+ const _RandomAccessIterator subresult = __internal::__brick_min_element(__begin, __end, __comp, __is_vector);
+ return __internal::__cmp_iterators_by_values(__init, subresult, __comp);
},
[=](_RandomAccessIterator __it1, _RandomAccessIterator __it2) -> _RandomAccessIterator {
- return __cmp_iterators_by_values(__it1, __it2, __comp);
+ return __internal::__cmp_iterators_by_values(__it1, __it2, __comp);
});
});
}
__pattern_minmax_element(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator __last, _Compare __comp,
_IsVector __is_vector, /* is_parallel = */ std::false_type) noexcept
{
- return __brick_minmax_element(__first, __last, __comp, __is_vector);
+ return __internal::__brick_minmax_element(__first, __last, __comp, __is_vector);
}
#if __PSTL_USE_PAR_POLICIES
if (__first == __last)
return std::make_pair(__first, __first);
- return __except_handler([&]() {
+ return __internal::__except_handler([&]() {
typedef std::pair<_ForwardIterator, _ForwardIterator> _Result;
return __par_backend::__parallel_reduce(
std::forward<_ExecutionPolicy>(__exec), __first + 1, __last, std::make_pair(__first, __first),
[=](_ForwardIterator __begin, _ForwardIterator __end, _Result __init) -> _Result {
- const _Result __subresult = __brick_minmax_element(__begin, __end, __comp, __is_vector);
+ const _Result __subresult = __internal::__brick_minmax_element(__begin, __end, __comp, __is_vector);
return std::make_pair(
- __cmp_iterators_by_values(__subresult.first, __init.first, __comp),
- __cmp_iterators_by_values(__init.second, __subresult.second, __not_pred<_Compare>(__comp)));
+ __internal::__cmp_iterators_by_values(__subresult.first, __init.first, __comp),
+ __internal::__cmp_iterators_by_values(__init.second, __subresult.second, __not_pred<_Compare>(__comp)));
},
[=](_Result __p1, _Result __p2) -> _Result {
return std::make_pair(
- __cmp_iterators_by_values(__p1.first, __p2.first, __comp),
- __cmp_iterators_by_values(__p2.second, __p1.second, __not_pred<_Compare>(__comp)));
+ __internal::__cmp_iterators_by_values(__p1.first, __p2.first, __comp),
+ __internal::__cmp_iterators_by_values(__p2.second, __p1.second, __not_pred<_Compare>(__comp)));
});
});
}
_ForwardIterator2 __first2, _ForwardIterator2 __last2, _Predicate __pred, _IsVector __is_vector,
/* is_parallel = */ std::false_type) noexcept
{
- return __brick_mismatch(__first1, __last1, __first2, __last2, __pred, __is_vector);
+ return __internal::__brick_mismatch(__first1, __last1, __first2, __last2, __pred, __is_vector);
}
#if __PSTL_USE_PAR_POLICIES
_RandomAccessIterator2 __first2, _RandomAccessIterator2 __last2, _Predicate __pred,
_IsVector __is_vector, /* is_parallel = */ std::true_type) noexcept
{
- return __except_handler([&]() {
+ return __internal::__except_handler([&]() {
auto __n = std::min(__last1 - __first1, __last2 - __first2);
- auto __result = __parallel_find(
+ auto __result = __internal::__parallel_find(
std::forward<_ExecutionPolicy>(__exec), __first1, __first1 + __n,
[__first1, __first2, __pred, __is_vector](_RandomAccessIterator1 __i, _RandomAccessIterator1 __j) {
- return __brick_mismatch(__i, __j, __first2 + (__i - __first1), __first2 + (__j - __first1), __pred,
+ return __internal::__brick_mismatch(__i, __j, __first2 + (__i - __first1), __first2 + (__j - __first1), __pred,
__is_vector)
.first;
},
_ForwardIterator2 __first2, _ForwardIterator2 __last2, _Compare __comp,
_IsVector __is_vector, /* is_parallel = */ std::false_type) noexcept
{
- return __brick_lexicographical_compare(__first1, __last1, __first2, __last2, __comp, __is_vector);
+ return __internal::__brick_lexicographical_compare(__first1, __last1, __first2, __last2, __comp, __is_vector);
}
#if __PSTL_USE_PAR_POLICIES
--__last1;
--__last2;
auto __n = std::min(__last1 - __first1, __last2 - __first2);
- auto __result = __parallel_find(
+ auto __result = __internal::__parallel_find(
std::forward<_ExecutionPolicy>(__exec), __first1, __first1 + __n,
[__first1, __first2, &__comp, __is_vector](_ForwardIterator1 __i, _ForwardIterator1 __j) {
- return __brick_mismatch(__i, __j, __first2 + (__i - __first1), __first2 + (__j - __first1),
+ return __internal::__brick_mismatch(__i, __j, __first2 + (__i - __first1), __first2 + (__j - __first1),
[&__comp](const _RefType1 __x, const _RefType2 __y) {
return !__comp(__x, __y) && !__comp(__y, __x);
},