Skip to content

Commit 845d065

Browse files
committed
asioexec::completion_token & ::use_sender: Non-Dependent Senders
asioexec::completion_token and ::use_sender are completion tokens which induce an initiating function to return a sender. Previously these senders were dependent, but this was not necessary: The completion signatures thereof are not changed by the environment. Updated the implementation so that the senders yielded by initiating functions parameterized by asioexec::completion_token or ::use_sender are no longer dependent.
1 parent 15ab912 commit 845d065

File tree

3 files changed

+18
-20
lines changed

3 files changed

+18
-20
lines changed

include/asioexec/completion_token.hpp

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -365,17 +365,14 @@ namespace asioexec {
365365
, args_(static_cast<Us&&>(us)...) {
366366
}
367367

368-
template <typename Env>
369-
requires std::is_copy_constructible_v<Initiation>
370-
&& std::is_copy_constructible_v<args_type_>
371-
constexpr Signatures get_completion_signatures(const Env&) const & noexcept {
372-
return {};
373-
}
374-
375-
template <typename Env>
376-
requires std::is_move_constructible_v<Initiation>
377-
&& std::is_move_constructible_v<args_type_>
378-
constexpr Signatures get_completion_signatures(const Env&) && noexcept {
368+
template <typename Self, typename... Env>
369+
requires std::is_constructible_v<
370+
Initiation,
371+
decltype(::STDEXEC::__forward_like<Self>(std::declval<Initiation&>()))>
372+
&& std::is_constructible_v<
373+
args_type_,
374+
decltype(::STDEXEC::__forward_like<Self>(std::declval<args_type_&>()))>
375+
static consteval Signatures get_completion_signatures() noexcept {
379376
return {};
380377
}
381378

include/asioexec/use_sender.hpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -158,15 +158,11 @@ namespace asioexec {
158158

159159
using sender_concept = ::STDEXEC::sender_t;
160160

161-
template <typename Env>
162-
constexpr completion_signatures<::STDEXEC::completion_signatures_of_t<Sender, Env>>
163-
get_completion_signatures(const Env&) && noexcept {
164-
return {};
165-
}
166-
167-
template <typename Env>
168-
constexpr completion_signatures<::STDEXEC::completion_signatures_of_t<const Sender&, Env>>
169-
get_completion_signatures(const Env&) const & noexcept {
161+
template <typename Self, typename... Env>
162+
static consteval completion_signatures<::STDEXEC::completion_signatures_of_t<
163+
decltype(::STDEXEC::__forward_like<Self>(std::declval<Sender&>())),
164+
Env...>>
165+
get_completion_signatures() noexcept {
170166
return {};
171167
}
172168

test/asioexec/test_use_sender.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ namespace {
8383
asio_impl::system_timer t(ctx);
8484
t.expires_after(std::chrono::years(1));
8585
auto sender = t.async_wait(use_sender);
86+
static_assert(::STDEXEC::sender_in<decltype(sender)>);
87+
static_assert(
88+
::STDEXEC::sender_of<
89+
decltype(sender),
90+
::STDEXEC::set_value_t()>);
8691
static_assert(
8792
set_equivalent<
8893
::STDEXEC::completion_signatures_of_t<decltype(sender), ::STDEXEC::env<>>,

0 commit comments

Comments
 (0)