Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bugprone-move-forwarding-reference violations #551

Merged
merged 3 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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