Skip to content

Commit

Permalink
Merge pull request #198 from cplusplus/when-all-lwg-feedback
Browse files Browse the repository at this point in the history
Apply LWG feedback for [exec.when.all] section from review on 2024-02-21
  • Loading branch information
ericniebler authored Feb 22, 2024
2 parents 6d97e0c + a9e77cb commit bf05569
Showing 1 changed file with 42 additions and 36 deletions.
78 changes: 42 additions & 36 deletions execution.bs
Original file line number Diff line number Diff line change
Expand Up @@ -5237,7 +5237,7 @@ enum class forward_progress_guarantee {
[dcl.struct.bind].</span>

5. The member <code><i>default-impls</i>::<i>get-attrs</i></code> is initialized
with a callable object equal to the following lambda:
with a callable object equivalent to the following lambda:

<pre highlight="c++">
[](const auto& data, const auto&... child) noexcept -> decltype(auto) {
Expand All @@ -5249,7 +5249,7 @@ enum class forward_progress_guarantee {
</pre>

6. The member <code><i>default-impls</i>::<i>get-env</i></code> is initialized
with a callable object equal to the following lambda:
with a callable object equivalent to the following lambda:

<pre highlight="c++">
[]&lt;class Rcvr>(auto index, auto& state, const Rcvr& rcvr) noexcept
Expand All @@ -5259,7 +5259,7 @@ enum class forward_progress_guarantee {
</pre>

7. The member <code><i>default-impls</i>::<i>get-state</i></code> is initialized
with a callable object equal to the following lambda:
with a callable object equivalent to the following lambda:

<pre highlight="c++">
[]&lt;class Sndr, class Rcvr>(Sndr&& sndr, Rcvr& rcvr) noexcept -> decltype(auto) {
Expand All @@ -5268,7 +5268,7 @@ enum class forward_progress_guarantee {
</pre>

8. The member <code><i>default-impls</i>::<i>start</i></code> is initialized
with a callable object equal to the following lambda:
with a callable object equivalent to the following lambda:

<pre highlight="c++">
[](auto& state, auto& rcvr, auto&... ops) noexcept -> void {
Expand All @@ -5277,7 +5277,7 @@ enum class forward_progress_guarantee {
</pre>

9. The member <code><i>default-impls</i>::<i>complete</i></code> is initialized
with a callable object equal to the following lambda:
with a callable object equivalent to the following lambda:

<pre highlight="c++">
[]&lt;class Index, class Rcvr, class Tag, class... Args>(
Expand Down Expand Up @@ -6145,7 +6145,7 @@ template&lt;class Domain, class Tag, sender Sndr, class... Args>
</pre>

1. The member <code><i>impls-for</i>&lt;schedule_from_t>::<i>get-attrs</i></code> is initialized
with a callable object equal to the following lambda:
with a callable object equivalent to the following lambda:

<pre highlight="c++">
[](const auto& data, const auto& child) noexcept -> decltype(auto) {
Expand All @@ -6154,7 +6154,7 @@ template&lt;class Domain, class Tag, sender Sndr, class... Args>
</pre>

2. The member <code><i>impls-for</i>&lt;schedule_from_t>::<i>get-state</i></code> is initialized
with a callable object equal to the following lambda:
with a callable object equivalent to the following lambda:

<pre highlight="c++">
[]&lt;class Sndr, class Rcvr>(Sndr&& sndr, Rcvr& rcvr)
Expand Down Expand Up @@ -6215,7 +6215,7 @@ template&lt;class Domain, class Tag, sender Sndr, class... Args>
</pre>

3. The member <code><i>impls-for</i>&lt;schedule_from_t>::<i>complete</i></code>
is initialized with a callable object equal to the following lambda:
is initialized with a callable object equivalent to the following lambda:

<pre highlight="c++">
[]&lt;class Tag, class... Args>(auto, auto& state, auto& rcvr, Tag, Args&&... args) noexcept -> void {
Expand Down Expand Up @@ -6370,7 +6370,7 @@ template&lt;class Domain, class Tag, sender Sndr, class... Args>
</pre>

2. <code><i>impls-for</i>&lt;tag_t&lt;<i>let-cpo</i>>>::<i>get-state</i></code> is
is initialized with a callable object equal to the following:
is initialized with a callable object equivalent to the following:

<pre highlight="c++">
[]&lt;class Sndr, class Rcvr>(Sndr&& sndr, Rcvr& rcvr) requires <i>see below</i> {
Expand Down Expand Up @@ -6425,7 +6425,7 @@ template&lt;class Domain, class Tag, sender Sndr, class... Args>
</pre>

4. <code><i>impls-for</i>&lt;tag_t&lt;<i>let-cpo</i>>>::<i>complete</i></code> is
is initialized with a callable object equal to the following:
is initialized with a callable object equivalent to the following:

<pre highlight="c++">
[]&lt;class Tag, class... Args>
Expand Down Expand Up @@ -6490,7 +6490,7 @@ template&lt;class Domain, class Tag, sender Sndr, class... Args>
</pre>

1. The member <code><i>impls-for</i>&lt;bulk_t>::complete</code> is
initialized with a callable object equal to the following lambda:
initialized with a callable object equivalent to the following lambda:

<pre highlight="c++">
[]&lt;class Index, class State, class Rcvr, class Tag, class... Args>
Expand Down Expand Up @@ -6806,7 +6806,7 @@ template&lt;class Domain, class Tag, sender Sndr, class... Args>

1. The member
<code><i>impls-for</i>&lt;<i>shared-impl-tag</i>>::<i>get-state</i></code>
is initialized with a callable object equal to the following lambda
is initialized with a callable object equivalent to the following lambda
expression:

<pre highlight="c++">
Expand Down Expand Up @@ -6907,7 +6907,7 @@ template&lt;class Domain, class Tag, sender Sndr, class... Args>
<i>make-sender</i>(when_all, {}, sndr<sub><i>0</i></sub>, ... sndr<sub><i>n-1</i></sub>));
</pre>

9. The exposition-only class template <code><i>impls-for</i></code>
4. The exposition-only class template <code><i>impls-for</i></code>
([exec.snd.general]) is specialized for `when_all_t` as follows:

<pre highlight="c++">
Expand All @@ -6922,7 +6922,7 @@ template&lt;class Domain, class Tag, sender Sndr, class... Args>
</pre>

1. The member <code><i>impls-for</i>&lt;when_all_t>::<i>get-attrs</i></code>
is initialized with a callable object equal to the following lambda
is initialized with a callable object equivalent to the following lambda
expression:

<pre highlight="c++">
Expand All @@ -6938,7 +6938,7 @@ template&lt;class Domain, class Tag, sender Sndr, class... Args>
</pre>

2. The member <code><i>impls-for</i>&lt;when_all_t>::<i>get-env</i></code>
is initialized with a callable object equal to the following lambda
is initialized with a callable object equivalent to the following lambda
expression:

<pre highlight="c++">
Expand All @@ -6949,7 +6949,7 @@ template&lt;class Domain, class Tag, sender Sndr, class... Args>
</pre>

3. The member <code><i>impls-for</i>&lt;when_all_t>::<i>get-state</i></code>
is initialized with a callable object equal to the following lambda
is initialized with a callable object equivalent to the following lambda
expression:

<pre highlight="c++">
Expand Down Expand Up @@ -7022,23 +7022,25 @@ template&lt;class Domain, class Tag, sender Sndr, class... Args>
noexcept</code> behaves as follows:

1. If `disp` is equal to <code><i>disposition</i>::<i>started</i></code>,
calls:
evaluates:

<pre highlight="c++">
auto tie = []&lt;class... T>(tuple&lt;T...>& t) noexcept { return tuple&lt;T&...>(t); };
auto set = [&](auto&... t) noexcept { set_value(std::move(rcvr), std::move(t)...); };

on_stop.reset();
apply(
[&](auto&... opts) noexcept {
if constexpr (sizeof...(opts) != 0)
apply(set, tuple_cat(tie(*opts)...));
apply(set, tuple_cat(tie(*opts)...));
},
values);
</pre>

2. Otherwise, if `disp` is equal to
<code><i>disposition</i>::<i>error</i></code>, calls:
<code><i>disposition</i>::<i>error</i></code>, evaluates:

<pre highlight="c++">
on_stop.reset();
visit(
[&]&lt;class Error>(Error& error) noexcept {
if constexpr (!same_as&lt;Error, <i>none-such</i>>) {
Expand All @@ -7048,10 +7050,15 @@ template&lt;class Domain, class Tag, sender Sndr, class... Args>
errors);
</pre>

3. Otherwise, calls `set_stopped(std::move(rcvr))`.
3. Otherwise, evaluates:

<pre highlight="c++">
on_stop.reset();
set_stopped(std::move(rcvr));
</pre>

4. The member <code><i>impls-for</i>&lt;when_all_t>::<i>start</i></code>
is initialized with a callable object equal to the following lambda
is initialized with a callable object equivalent to the following lambda
expression:

<pre highlight="c++">
Expand All @@ -7061,15 +7068,16 @@ template&lt;class Domain, class Tag, sender Sndr, class... Args>
get_stop_token(get_env(rcvr)),
<i>on-stop-request</i>{state.stop_src});
if (state.stop_src.stop_requested()) {
state.on_stop.reset();
set_stopped(std::move(rcvr));
} else {
(start(ops), ...);
}
}
</pre>

4. The member <code><i>impls-for</i>&lt;when_all_t>::<i>complete</i></code>
is initialized with a callable object equal to the following lambda
5. The member <code><i>impls-for</i>&lt;when_all_t>::<i>complete</i></code>
is initialized with a callable object equivalent to the following lambda
expression:

<pre highlight="c++">
Expand All @@ -7096,8 +7104,7 @@ template&lt;class Domain, class Tag, sender Sndr, class... Args>
}
</pre>

where for subexpressions `v` and `e`, <code><i>TRY-EMPLACE-ERROR</i>(v,
e)</code> is equivalent to:
where <code><i>TRY-EMPLACE-ERROR</i>(v, e)</code>, for subexpressions `v` and `e`, is equivalent to:

<pre highlight="c++">
try {
Expand All @@ -7108,9 +7115,8 @@ template&lt;class Domain, class Tag, sender Sndr, class... Args>
</pre>

if the expression `decltype(auto(e))(e)` is potentially throwing; otherwise,
`v.template emplace<decltype(auto(e))>(e)`; and where for subexpressions
`c`, `o`, and pack of subexpressions `as`, <code><i>TRY-EMPLACE-VALUE</i>(c,
o, as...)</code> is equivalent to:
`v.template emplace<decltype(auto(e))>(e)`; and where <code><i>TRY-EMPLACE-VALUE</i>(c,
o, as...)</code>, for subexpressions `c`, `o`, and pack of subexpressions `as`, is equivalent to:

<pre highlight="c++">
try {
Expand All @@ -7133,14 +7139,14 @@ template&lt;class Domain, class Tag, sender Sndr, class... Args>
<i>make-sender</i>(when_all_with_variant, {}, sndr<sub><i>0</i></sub>, ... sndr<sub><i>n-1</i></sub>));
</pre>

6. Let `sndr` and `env` be subexpressions such that `Sndr` is `decltype((sndr))`. If
<code><i>sender-for</i>&lt;Sndr, when_all_with_variant_t></code> is `false`,
6. Given subexpressions `sndr` and `env`, if
<code><i>sender-for</i>&lt;decltype((sndr)), when_all_with_variant_t></code> is `false`,
then the expression `when_all_with_variant.transform_sender(sndr, env)` is
ill-formed; otherwise, it is equal to:
ill-formed; otherwise, the body of the `transform_sender` member-function is equivalent to:

<pre highlight="c++">
auto [tag, data, ...child] = sndr;
return when_all(into_variant(std::move(child))...);
auto [tag, data, ...child] = sndr;
return when_all(into_variant(std::move(child))...);
</pre>

<span class="wg21note">This causes the `when_all_with_variant(sndr...)` sender
Expand Down Expand Up @@ -7188,7 +7194,7 @@ template&lt;class Domain, class Tag, sender Sndr, class... Args>

1. The member
<code><i>impls-for</i>&lt;into_variant_t>::<i>get-state</i></code> is
initialized with a callable object equal to the following lambda:
initialized with a callable object equivalent to the following lambda:

<pre highlight="c++">
[]&lt;class Sndr, class Rcvr>(Sndr&& sndr, Rcvr& rcvr) noexcept
Expand All @@ -7198,7 +7204,7 @@ template&lt;class Domain, class Tag, sender Sndr, class... Args>
</pre>

2. The member <code><i>impls-for</i>&lt;into_variant_t>::<i>complete</i></code>
is initialized with a callable object equal to the following lambda:
is initialized with a callable object equivalent to the following lambda:

<pre highlight="c++">
[]&lt;class State, class Rcvr, class Tag, class... Args>(
Expand Down

0 comments on commit bf05569

Please sign in to comment.