Skip to content

Commit

Permalink
Fix bugprone-move-forwarding-reference violations (#551)
Browse files Browse the repository at this point in the history
Fix bugprone-move-forwarding-reference violations
  • Loading branch information
ccotter authored Jul 6, 2023
1 parent 0df7f0b commit 2d1ba75
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion include/unifex/async_manual_reset_event.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ auto connect_as_unstoppable(Receiver&& r) noexcept(
Receiver>) {
return connect(
with_query_value(schedule(), get_stop_token, unstoppable_token{}),
std::move(r));
std::forward<Receiver>(r));
}

template <typename Receiver>
Expand Down
2 changes: 1 addition & 1 deletion include/unifex/find_if.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ struct _receiver<Predecessor, Receiver, Func, FuncPolicy>::type {
return
unifex::let_value(
unifex::just(std::forward<Values>(values)...),
[func = std::move(func_), sched = std::move(sched), begin_it,
[func = std::move(func_), sched = std::forward<Scheduler>(sched), begin_it,
chunk_size, end_it, num_chunks](Values&... values) mutable {
return unifex::let_value_with([&](){return State{false, std::vector<Iterator>(num_chunks, end_it)};},[&](State& state) {
// Inject a stop source and make it available for inner operations.
Expand Down
2 changes: 1 addition & 1 deletion include/unifex/task.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ struct _promise final {
transform_schedule_sender_impl_(get_scheduler(snd));

// Return the inner sender, appropriately wrapped in an awaitable:
return unifex::await_transform(*this, std::move(snd).base());
return unifex::await_transform(*this, std::forward<ScheduleSender>(snd).base());
}
};
};
Expand Down
4 changes: 2 additions & 2 deletions include/unifex/v1/async_scope.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ struct _attach_receiver<Receiver>::type final {
template(typename CPO) //
(requires is_receiver_query_cpo_v<CPO>) //
friend auto tag_invoke(CPO&& cpo, const type& r) noexcept
-> decltype(std::move(cpo)(std::declval<const Receiver&>())) {
return std::move(cpo)(r.op_->receiver_);
-> decltype(std::forward<CPO>(cpo)(std::declval<const Receiver&>())) {
return std::forward<CPO>(cpo)(r.op_->receiver_);
}

typename _attach_op_base<Receiver>::type* op_;
Expand Down
8 changes: 4 additions & 4 deletions include/unifex/v2/async_scope.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ struct _nest_receiver<Sender, Receiver>::type final {

template <typename... T>
void set_value(T... values) noexcept {
complete([&](auto&& receiver) noexcept {
complete([&](Receiver&& receiver) noexcept {
UNIFEX_TRY {
unifex::set_value(std::move(receiver), std::move(values)...);
}
Expand All @@ -274,7 +274,7 @@ struct _nest_receiver<Sender, Receiver>::type final {

template <typename E>
void set_error(E e) noexcept {
complete([&](auto&& receiver) noexcept {
complete([&](Receiver&& receiver) noexcept {
unifex::set_error(std::move(receiver), std::move(e));
});
}
Expand All @@ -301,8 +301,8 @@ struct _nest_receiver<Sender, Receiver>::type final {
template(typename CPO) //
(requires is_receiver_query_cpo_v<CPO>) //
friend auto tag_invoke(CPO&& cpo, const type& r) noexcept
-> decltype(std::move(cpo)(std::declval<const Receiver&>())) {
return std::move(cpo)(r.op_->receiver_);
-> decltype(std::forward<CPO>(cpo)(std::declval<const Receiver&>())) {
return std::forward<CPO>(cpo)(r.op_->receiver_);
}
};

Expand Down

0 comments on commit 2d1ba75

Please sign in to comment.