Skip to content

Commit e84fb45

Browse files
Pass _SizeFunction __size_func as parameter into __copy_union_when_disjointed
1 parent 54dcd1a commit e84fb45

File tree

2 files changed

+20
-21
lines changed

2 files changed

+20
-21
lines changed

include/oneapi/dpl/pstl/algorithm_impl.h

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3383,12 +3383,12 @@ struct _SumSize
33833383
};
33843384

33853385
template <class _IsVector, typename _ExecutionPolicy, typename _RandomAccessIterator1, typename _RandomAccessIterator2,
3386-
typename _OutputIterator, typename _SetOP, typename _Compare, typename _Proj1, typename _Proj2>
3386+
typename _OutputIterator, typename _SizeFunction, typename _SetOP, typename _Compare, typename _Proj1, typename _Proj2>
33873387
std::pair<_OutputIterator, bool>
33883388
__copy_union_when_disjointed(__parallel_tag<_IsVector> __tag, _ExecutionPolicy&& __exec,
33893389
_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1,
33903390
_RandomAccessIterator2 __first2, _RandomAccessIterator2 __last2, _OutputIterator __result,
3391-
_SetOP __set_op, _Compare __comp, _Proj1 __proj1, _Proj2 __proj2)
3391+
_SizeFunction __size_func, _SetOP __set_op, _Compare __comp, _Proj1 __proj1, _Proj2 __proj2)
33923392
{
33933393
using __backend_tag = typename __parallel_tag<_IsVector>::__backend_tag;
33943394

@@ -3458,8 +3458,6 @@ __copy_union_when_disjointed(__parallel_tag<_IsVector> __tag, _ExecutionPolicy&&
34583458
return {__result_last, true};
34593459
}
34603460

3461-
_SumSize<_DifferenceType1, _DifferenceType2> __sum_size;
3462-
34633461
const auto __m1 = __left_bound_seq_1 - __first1;
34643462
if (__m1 > __set_algo_cut_off)
34653463
{
@@ -3474,7 +3472,7 @@ __copy_union_when_disjointed(__parallel_tag<_IsVector> __tag, _ExecutionPolicy&&
34743472
[=, &__exec, &__result] {
34753473
__result =
34763474
__internal::__parallel_set_op(__tag, __exec, __left_bound_seq_1, __last1, __first2, __last2,
3477-
__result, __sum_size, __set_op, __comp, __proj1, __proj2);
3475+
__result, __size_func, __set_op, __comp, __proj1, __proj2);
34783476
});
34793477
return {__result, true};
34803478
}
@@ -3493,7 +3491,7 @@ __copy_union_when_disjointed(__parallel_tag<_IsVector> __tag, _ExecutionPolicy&&
34933491
},
34943492
[=, &__exec, &__result] {
34953493
__result = __internal::__parallel_set_op(__tag, __exec, __first1, __last1, __left_bound_seq_2, __last2,
3496-
__result, __sum_size, __set_op, __comp, __proj1, __proj2);
3494+
__result, __size_func, __set_op, __comp, __proj1, __proj2);
34973495
});
34983496
return {__result, true};
34993497
}
@@ -3574,16 +3572,17 @@ __pattern_set_union(__parallel_tag<_IsVector> __tag, _ExecutionPolicy&& __exec,
35743572
oneapi::dpl::identity{}, oneapi::dpl::identity{});
35753573
};
35763574

3575+
_SumSize<_DifferenceType1, _DifferenceType2> __size_func;
3576+
35773577
auto [__result_last, __copied] =
3578-
__copy_union_when_disjointed(__tag, __exec, __first1, __last1, __first2, __last2, __result, __set_op, __comp,
3579-
oneapi::dpl::identity{}, oneapi::dpl::identity{});
3578+
__copy_union_when_disjointed(__tag, __exec, __first1, __last1, __first2, __last2, __result, __size_func,
3579+
__set_op, __comp, oneapi::dpl::identity{}, oneapi::dpl::identity{});
35803580
if (__copied)
35813581
return __result_last;
35823582

3583-
_SumSize<_DifferenceType1, _DifferenceType2> __sum_size;
35843583

35853584
return __internal::__parallel_set_op(__tag, std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __first2,
3586-
__last2, __result, __sum_size, __set_op, __comp, oneapi::dpl::identity{},
3585+
__last2, __result, __size_func, __set_op, __comp, oneapi::dpl::identity{},
35873586
oneapi::dpl::identity{});
35883587
}
35893588

@@ -3849,7 +3848,7 @@ __pattern_set_symmetric_difference(__parallel_tag<_IsVector> __tag, _ExecutionPo
38493848
if (__n1 + __n2 <= __set_algo_cut_off)
38503849
return std::set_symmetric_difference(__first1, __last1, __first2, __last2, __result, __comp);
38513850

3852-
_SumSize<_DifferenceType1, _DifferenceType2> __sum_size;
3851+
_SumSize<_DifferenceType1, _DifferenceType2> __size_func;
38533852

38543853
auto __set_op = [](_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1, _RandomAccessIterator2 __first2,
38553854
_RandomAccessIterator2 __last2, _T* __result, _Compare __comp, oneapi::dpl::identity,
@@ -3861,13 +3860,13 @@ __pattern_set_symmetric_difference(__parallel_tag<_IsVector> __tag, _ExecutionPo
38613860

38623861
return __internal::__except_handler([&]() {
38633862
auto [__result_last, __copied] =
3864-
__copy_union_when_disjointed(__tag, __exec, __first1, __last1, __first2, __last2, __result, __set_op,
3865-
__comp, oneapi::dpl::identity{}, oneapi::dpl::identity{});
3863+
__copy_union_when_disjointed(__tag, __exec, __first1, __last1, __first2, __last2, __result, __size_func,
3864+
__set_op, __comp, oneapi::dpl::identity{}, oneapi::dpl::identity{});
38663865
if (__copied)
38673866
return __result_last;
38683867

38693868
return __internal::__parallel_set_op(__tag, std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __first2,
3870-
__last2, __result, __sum_size, __set_op, __comp, oneapi::dpl::identity{},
3869+
__last2, __result, __size_func, __set_op, __comp, oneapi::dpl::identity{},
38713870
oneapi::dpl::identity{});
38723871
});
38733872
}

include/oneapi/dpl/pstl/algorithm_ranges_impl.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -800,11 +800,11 @@ __pattern_set_union(__parallel_tag<_IsVector> __tag, _ExecutionPolicy&& __exec,
800800
auto __last2 = __first2 + __n2;
801801
auto __result = std::ranges::begin(__out_r);
802802

803-
oneapi::dpl::__internal::_SumSize<_DifferenceType1, _DifferenceType2> __sum_size;
803+
oneapi::dpl::__internal::_SumSize<_DifferenceType1, _DifferenceType2> __size_func;
804804

805805
auto __set_op = [](_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1, _RandomAccessIterator2 __first2,
806806
_RandomAccessIterator2 __last2, _Tp* __result, _Comp __comp, _Proj1 __proj1, _Proj2 __proj2) {
807-
return oneapi::dpl::__utils::__set_union_construct(__first1, __last1, __first2, __last2, __result,
807+
return oneapi::dpl::__utils::__set_union_construct(__first1, __last1, __first2, __last2, __result, __size_func,
808808
oneapi::dpl::__internal::__BrickCopyConstruct<_IsVector>(),
809809
__comp, __proj1, __proj2);
810810
};
@@ -816,7 +816,7 @@ __pattern_set_union(__parallel_tag<_IsVector> __tag, _ExecutionPolicy&& __exec,
816816

817817
auto __out_last = oneapi::dpl::__internal::__parallel_set_op(__tag, std::forward<_ExecutionPolicy>(__exec),
818818
__first1, __last1, __first2, __last2, __result,
819-
__sum_size, __set_op, __comp, __proj1, __proj2);
819+
__size_func, __set_op, __comp, __proj1, __proj2);
820820

821821
return __pattern_set_union_return_t<_R1, _R2, _OutRange>{__last1, __last2, __out_last};
822822
}
@@ -1141,7 +1141,7 @@ __pattern_set_symmetric_difference(__parallel_tag<_IsVector> __tag, _ExecutionPo
11411141
auto __last2 = __first2 + __n2;
11421142
auto __result = std::ranges::begin(__out_r);
11431143

1144-
oneapi::dpl::__internal::_SumSize<_DifferenceType1, _DifferenceType2> __sum_size;
1144+
oneapi::dpl::__internal::_SumSize<_DifferenceType1, _DifferenceType2> __size_func;
11451145

11461146
auto __set_op = [](_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1, _RandomAccessIterator2 __first2,
11471147
_RandomAccessIterator2 __last2, _Tp* __result, _Comp __comp, _Proj1 __proj1, _Proj2 __proj2) {
@@ -1150,14 +1150,14 @@ __pattern_set_symmetric_difference(__parallel_tag<_IsVector> __tag, _ExecutionPo
11501150
__comp, __proj1, __proj2);
11511151
};
11521152

1153-
auto [__result_last, __copied] = __copy_union_when_disjointed(__tag, __exec, __first1, __last1, __first2, __last2,
1154-
__result, __set_op, __comp, __proj1, __proj2);
1153+
auto [__result_last, __copied] = __copy_union_when_disjointed(
1154+
__tag, __exec, __first1, __last1, __first2, __last2, __result, __size_func, __set_op, __comp, __proj1, __proj2);
11551155
if (__copied)
11561156
return __pattern_set_symmetric_difference_return_t<_R1, _R2, _OutRange>{__last1, __last2, __result_last};
11571157

11581158
auto __out_last = oneapi::dpl::__internal::__parallel_set_op(__tag, std::forward<_ExecutionPolicy>(__exec),
11591159
__first1, __last1, __first2, __last2, __result,
1160-
__sum_size, __set_op, __comp, __proj1, __proj2);
1160+
__size_func, __set_op, __comp, __proj1, __proj2);
11611161

11621162
return __pattern_set_symmetric_difference_return_t<_R1, _R2, _OutRange>{__last1, __last2, __out_last};
11631163
}

0 commit comments

Comments
 (0)