Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
zhekemist committed Aug 17, 2024
1 parent 93480e5 commit d8f0c52
Show file tree
Hide file tree
Showing 24 changed files with 101 additions and 117 deletions.
40 changes: 19 additions & 21 deletions libs/core/algorithms/include/hpx/parallel/algorithms/is_heap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,8 @@ namespace hpx::parallel {
{
template <typename ExPolicy, typename Iter, typename Sent,
typename Comp, typename Proj>
decltype(auto) operator()(
ExPolicy&& orgpolicy, Iter first, Sent last, Comp&& comp,
Proj&& proj)
decltype(auto) operator()(ExPolicy&& orgpolicy, Iter first,
Sent last, Comp&& comp, Proj&& proj)
{
using result = util::detail::algorithm_result<ExPolicy, bool>;
using type = typename std::iterator_traits<Iter>::value_type;
Expand All @@ -283,7 +282,8 @@ namespace hpx::parallel {
// underflow prevention
++count;
}
} else
}
else
{
if (count <= 1)
{
Expand Down Expand Up @@ -362,9 +362,8 @@ namespace hpx::parallel {

template <typename ExPolicy, typename Iter, typename Sent,
typename Comp, typename Proj>
static decltype(auto) parallel(
ExPolicy&& policy, Iter first, Sent last, Comp&& comp,
Proj&& proj)
static decltype(auto) parallel(ExPolicy&& policy, Iter first,
Sent last, Comp&& comp, Proj&& proj)
{
return is_heap_helper()(HPX_FORWARD(ExPolicy, policy), first,
last, HPX_FORWARD(Comp, comp), HPX_FORWARD(Proj, proj));
Expand Down Expand Up @@ -399,9 +398,8 @@ namespace hpx::parallel {
{
template <typename ExPolicy, typename Iter, typename Sent,
typename Comp, typename Proj>
decltype(auto) operator()(
ExPolicy&& orgpolicy, Iter first, Sent last, Comp comp,
Proj proj)
decltype(auto) operator()(ExPolicy&& orgpolicy, Iter first,
Sent last, Comp comp, Proj proj)
{
using result = util::detail::algorithm_result<ExPolicy, Iter>;
using type = typename std::iterator_traits<Iter>::value_type;
Expand All @@ -419,11 +417,13 @@ namespace hpx::parallel {
{
count = 0;
second = last;
} else
}
else
{
return result::get(HPX_MOVE(last));
}
} else
}
else
{
second = first + 1;
--count;
Expand Down Expand Up @@ -500,9 +500,8 @@ namespace hpx::parallel {

template <typename ExPolicy, typename Iter, typename Sent,
typename Comp, typename Proj>
static decltype(auto) parallel(
ExPolicy&& policy, Iter first, Sent last, Comp&& comp,
Proj&& proj)
static decltype(auto) parallel(ExPolicy&& policy, Iter first,
Sent last, Comp&& comp, Proj&& proj)
{
return is_heap_until_helper()(HPX_FORWARD(ExPolicy, policy),
first, last, HPX_FORWARD(Comp, comp),
Expand Down Expand Up @@ -532,9 +531,8 @@ namespace hpx {
>
)>
// clang-format on
friend decltype(auto)
tag_fallback_invoke(is_heap_t, ExPolicy&& policy, RandIter first,
RandIter last, Comp comp = Comp())
friend decltype(auto) tag_fallback_invoke(is_heap_t, ExPolicy&& policy,
RandIter first, RandIter last, Comp comp = Comp())
{
static_assert(hpx::traits::is_random_access_iterator_v<RandIter>,
"Requires a random access iterator.");
Expand Down Expand Up @@ -585,9 +583,9 @@ namespace hpx {
>
)>
// clang-format on
friend decltype(auto)
tag_fallback_invoke(is_heap_until_t, ExPolicy&& policy, RandIter first,
RandIter last, Comp comp = Comp())
friend decltype(auto) tag_fallback_invoke(is_heap_until_t,
ExPolicy&& policy, RandIter first, RandIter last,
Comp comp = Comp())
{
static_assert(hpx::traits::is_random_access_iterator_v<RandIter>,
"Requires a random access iterator.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,8 @@ namespace hpx::parallel {
}

template <typename ExPolicy, typename Pred, typename Proj>
static decltype(auto) parallel(
ExPolicy&& policy, Iter first, Sent last, Pred&& pred,
Proj&& proj)
static decltype(auto) parallel(ExPolicy&& policy, Iter first,
Sent last, Pred&& pred, Proj&& proj)
{
using difference_type =
typename std::iterator_traits<Iter>::difference_type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,8 @@ namespace hpx::parallel {
}

template <typename ExPolicy, typename Pred, typename Proj>
static decltype(auto) parallel(
ExPolicy&& policy, FwdIter first, Sent last, Pred&& pred,
Proj&& proj)
static decltype(auto) parallel(ExPolicy&& policy, FwdIter first,
Sent last, Pred&& pred, Proj&& proj)
{
using difference_type =
typename std::iterator_traits<FwdIter>::difference_type;
Expand Down
20 changes: 10 additions & 10 deletions libs/core/algorithms/include/hpx/parallel/algorithms/mismatch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -593,9 +593,9 @@ namespace hpx::parallel {
template <typename ExPolicy, typename Iter1, typename Sent1,
typename Iter2, typename Sent2, typename F, typename Proj1,
typename Proj2>
static decltype(auto)
parallel(ExPolicy&& orgpolicy, Iter1 first1, Sent1 last1,
Iter2 first2, Sent2 last2, F&& f, Proj1&& proj1, Proj2&& proj2)
static decltype(auto) parallel(ExPolicy&& orgpolicy, Iter1 first1,
Sent1 last1, Iter2 first2, Sent2 last2, F&& f, Proj1&& proj1,
Proj2&& proj2)
{
constexpr bool has_scheduler_executor =
hpx::execution_policy_has_scheduler_executor_v<ExPolicy>;
Expand All @@ -605,8 +605,8 @@ namespace hpx::parallel {
if (first1 == last1 || first2 == last2)
{
return util::detail::algorithm_result<ExPolicy,
util::in_in_result<Iter1, Iter2>>::
get(util::in_in_result<Iter1, Iter2>{first1, first2});
util::in_in_result<Iter1, Iter2>>::get(util::
in_in_result<Iter1, Iter2>{first1, first2});
}
}

Expand All @@ -622,8 +622,7 @@ namespace hpx::parallel {

using policy_type = std::decay_t<decltype(policy)>;

hpx::parallel::util::cancellation_token<std::size_t> tok(
count);
hpx::parallel::util::cancellation_token<std::size_t> tok(count);

auto f1 = [tok, f = HPX_FORWARD(F, f),
proj1 = HPX_FORWARD(Proj1, proj1),
Expand Down Expand Up @@ -679,9 +678,10 @@ namespace hpx::parallel {
decltype(auto) get_pair(InInSender&& in_in_sender) noexcept
{
return hpx::execution::experimental::then(
HPX_FORWARD(InInSender, in_in_sender), [](auto&& in_in_result) {
return get_pair(HPX_FORWARD(decltype(in_in_result), in_in_result));
});
HPX_FORWARD(InInSender, in_in_sender), [](auto&& in_in_result) {
return get_pair(
HPX_FORWARD(decltype(in_in_result), in_in_result));
});
}

template <typename I1, typename I2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,7 @@ namespace hpx::parallel {
});
};

auto f2 =
[flags, first, count](auto&&...) mutable -> Iter {
auto f2 = [flags, first, count](auto&&...) mutable -> Iter {
auto part_begin = zip_iterator(first, flags.get());
auto dest = first;
auto part_size = count;
Expand Down
41 changes: 19 additions & 22 deletions libs/core/algorithms/include/hpx/parallel/algorithms/rotate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,8 @@ namespace hpx::parallel {

template <typename ExPolicy, typename FwdIter1, typename Sent,
typename FwdIter2>
decltype(auto) rotate_copy_helper(
ExPolicy policy, FwdIter1 first, FwdIter1 new_first, Sent last,
FwdIter2 dest_first)
decltype(auto) rotate_copy_helper(ExPolicy policy, FwdIter1 first,
FwdIter1 new_first, Sent last, FwdIter2 dest_first)
{
constexpr bool has_scheduler_executor =
hpx::execution_policy_has_scheduler_executor_v<ExPolicy>;
Expand All @@ -403,31 +402,31 @@ namespace hpx::parallel {
if constexpr (!has_scheduler_executor)
{
auto p = hpx::execution::parallel_task_policy()
.on(policy.executor())
.with(policy.parameters());
.on(policy.executor())
.with(policy.parameters());

hpx::future<copy_return_type> f =
detail::copy<copy_return_type>().call2(
p, non_seq(), new_first, last, dest_first);

return f.then([p, first, new_first](hpx::future<copy_return_type>&& result)
return f.then([p, first, new_first](
hpx::future<copy_return_type>&& result)
-> hpx::future<copy_return_type> {
copy_return_type p1 = result.get();
return detail::copy<copy_return_type>().call2(
p, non_seq(), first, new_first, p1.out);
});
} else
}
else
{
return detail::copy<copy_return_type>().call(
policy, new_first, last, dest_first)
| hpx::execution::experimental::let_value(
[policy, first, new_first](copy_return_type& result) {
return detail::copy<copy_return_type>().call(
policy, first, new_first, result.out);
}
);
policy, new_first, last, dest_first) |
hpx::execution::experimental::let_value(
[policy, first, new_first](copy_return_type& result) {
return detail::copy<copy_return_type>().call(
policy, first, new_first, result.out);
});
}

}

template <typename IterPair>
Expand All @@ -450,9 +449,8 @@ namespace hpx::parallel {

template <typename ExPolicy, typename FwdIter1, typename Sent,
typename FwdIter2>
static decltype(auto)
parallel(ExPolicy&& policy, FwdIter1 first, FwdIter1 new_first,
Sent last, FwdIter2 dest_first)
static decltype(auto) parallel(ExPolicy&& policy, FwdIter1 first,
FwdIter1 new_first, Sent last, FwdIter2 dest_first)
{
return util::detail::algorithm_result<ExPolicy, IterPair>::get(
rotate_copy_helper(HPX_FORWARD(ExPolicy, policy), first,
Expand Down Expand Up @@ -578,10 +576,9 @@ namespace hpx {
hpx::traits::is_iterator_v<FwdIter2>
)>
// clang-format on
friend decltype(auto)
tag_fallback_invoke(hpx::rotate_copy_t, ExPolicy&& policy,
FwdIter1 first, FwdIter1 new_first, FwdIter1 last,
FwdIter2 dest_first)
friend decltype(auto) tag_fallback_invoke(hpx::rotate_copy_t,
ExPolicy&& policy, FwdIter1 first, FwdIter1 new_first,
FwdIter1 last, FwdIter2 dest_first)
{
static_assert(hpx::traits::is_forward_iterator_v<FwdIter1>,
"Requires at least forward iterator.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,9 @@ namespace hpx::parallel {

auto end_first = std::next(first1, dist2);

return detail::equal_binary{}.call(hpx::execution::seq,
first1, end_first, first2,
last2, HPX_FORWARD(Pred, pred),
HPX_FORWARD(Proj1, proj1), HPX_FORWARD(Proj2, proj2));
return detail::equal_binary{}.call(hpx::execution::seq, first1,
end_first, first2, last2, HPX_FORWARD(Pred, pred),
HPX_FORWARD(Proj1, proj1), HPX_FORWARD(Proj2, proj2));
}

template <typename ExPolicy, typename FwdIter1, typename Sent1,
Expand All @@ -239,19 +238,20 @@ namespace hpx::parallel {
// make sure that the two ranges passed to equal_binary
// have different length to get `false` as return value
dist2 = 0;
} else
}
else
{
return util::detail::algorithm_result<ExPolicy,
bool>::get(false);
bool>::get(false);
}
}

auto end_first = std::next(first1, dist2);

return detail::equal_binary{}.call(
HPX_FORWARD(ExPolicy, policy), first1, end_first, first2,
last2, HPX_FORWARD(Pred, pred),
HPX_FORWARD(Proj1, proj1), HPX_FORWARD(Proj2, proj2));
last2, HPX_FORWARD(Pred, pred), HPX_FORWARD(Proj1, proj1),
HPX_FORWARD(Proj2, proj2));
}
};
/// \endcond
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -470,9 +470,8 @@ namespace hpx::parallel {

template <typename ExPolicy, typename Iter, typename Sent,
typename T_, typename Reduce, typename Convert>
static decltype(auto) parallel(
ExPolicy&& policy, Iter first, Sent last, T_&& init, Reduce&& r,
Convert&& conv)
static decltype(auto) parallel(ExPolicy&& policy, Iter first,
Sent last, T_&& init, Reduce&& r, Convert&& conv)
{
constexpr bool has_scheduler_executor =
hpx::execution_policy_has_scheduler_executor_v<ExPolicy>;
Expand Down Expand Up @@ -533,9 +532,8 @@ namespace hpx::parallel {

template <typename ExPolicy, typename Iter, typename Sent,
typename Iter2, typename T_, typename Op1, typename Op2>
static decltype(auto) parallel(
ExPolicy&& policy, Iter first1, Sent last1, Iter2 first2,
T_&& init, Op1&& op1, Op2&& op2)
static decltype(auto) parallel(ExPolicy&& policy, Iter first1,
Sent last1, Iter2 first2, T_&& init, Op1&& op1, Op2&& op2)
{
using result = util::detail::algorithm_result<ExPolicy, T>;
using zip_iterator = hpx::util::zip_iterator<Iter, Iter2>;
Expand All @@ -553,7 +551,6 @@ namespace hpx::parallel {
}
}


difference_type count = detail::distance(first1, last1);

auto f1 = [op1, op2 = HPX_FORWARD(Op2, op2)](
Expand Down Expand Up @@ -583,8 +580,8 @@ namespace hpx::parallel {
T ret = HPX_MOVE(init);
for (auto&& result : results)
{
ret = HPX_INVOKE(op1, HPX_MOVE(ret),
hpx::unwrap(result));
ret = HPX_INVOKE(
op1, HPX_MOVE(ret), hpx::unwrap(result));
}
return ret;
});
Expand Down Expand Up @@ -619,9 +616,9 @@ namespace hpx {
>
)>
// clang-format on
friend decltype(auto)
tag_fallback_invoke(transform_reduce_t, ExPolicy&& policy,
FwdIter first, FwdIter last, T init, Reduce red_op, Convert conv_op)
friend decltype(auto) tag_fallback_invoke(transform_reduce_t,
ExPolicy&& policy, FwdIter first, FwdIter last, T init,
Reduce red_op, Convert conv_op)
{
static_assert(hpx::traits::is_forward_iterator_v<FwdIter>,
"Requires at least forward iterator.");
Expand Down Expand Up @@ -668,9 +665,9 @@ namespace hpx {
hpx::traits::is_iterator_v<FwdIter2>
)>
// clang-format on
friend decltype(auto)
tag_fallback_invoke(transform_reduce_t, ExPolicy&& policy,
FwdIter1 first1, FwdIter1 last1, FwdIter2 first2, T init)
friend decltype(auto) tag_fallback_invoke(transform_reduce_t,
ExPolicy&& policy, FwdIter1 first1, FwdIter1 last1, FwdIter2 first2,
T init)
{
static_assert(hpx::traits::is_forward_iterator_v<FwdIter1>,
"Requires at least forward iterator.");
Expand Down Expand Up @@ -727,10 +724,9 @@ namespace hpx {
>
)>
// clang-format on
friend decltype(auto)
tag_fallback_invoke(transform_reduce_t, ExPolicy&& policy,
FwdIter1 first1, FwdIter1 last1, FwdIter2 first2, T init,
Reduce red_op, Convert conv_op)
friend decltype(auto) tag_fallback_invoke(transform_reduce_t,
ExPolicy&& policy, FwdIter1 first1, FwdIter1 last1, FwdIter2 first2,
T init, Reduce red_op, Convert conv_op)
{
static_assert(hpx::traits::is_forward_iterator_v<FwdIter1>,
"Requires at least forward iterator.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,7 @@ namespace hpx::parallel {
});
};

auto f2 =
[flags, first, count](auto&&...) mutable -> FwdIter {
auto f2 = [flags, first, count](auto&&...) mutable -> FwdIter {
auto part_begin = zip_iterator(first, flags.get());
auto dest = first;
auto part_size = count;
Expand Down
Loading

0 comments on commit d8f0c52

Please sign in to comment.