Skip to content

Commit c3dff2b

Browse files
committed
fixup: add upto 34.9.11.9
1 parent 6b23723 commit c3dff2b

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed

source/exec.tex

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3487,6 +3487,93 @@
34873487
propagates the other completion operations sent by \tcode{sndr}.
34883488
\end{itemize}
34893489

3490+
\rSec3[exec.bulk]{\tcode{execution::bulk}}
3491+
3492+
\pnum
3493+
\tcode{bulk} runs a task repeatedly for every index in an index space.
3494+
3495+
The name \tcode{bulk} denotes a pipeable sender adaptor object.
3496+
For subexpressions \tcode{sndr}, \tcode{shape}, and \tcode{f},
3497+
let \tcode{Shape} be \tcode{decltype(auto(shape))}.
3498+
If
3499+
\begin{itemize}
3500+
\item
3501+
\tcode{decltype((sndr))} does not satisfy \libconcept{sender}, or
3502+
\item
3503+
\tcode{Shape} does not satisfy \libconcept{integral}, or
3504+
\item
3505+
\tcode{decltype((f))} does not satisfy \exposconcept{movable-value},
3506+
\end{itemize}
3507+
\tcode{bulk(sndr, shape, f)} is ill-formed.
3508+
3509+
\pnum
3510+
Otherwise,
3511+
the expression \tcode{bulk(sndr, shape, f)} is expression-equivalent to:
3512+
3513+
\begin{codeblock}
3514+
transform_sender(@\exposid{get-domain-early}@(sndr), @\exposid{make-sender}@(bulk, @\exposid{product-type}@{shape, f}, sndr))
3515+
\end{codeblock}
3516+
except that \tcode{sndr} is evaluated only once.
3517+
3518+
\pnum
3519+
The exposition-only class template \exposid{impls-for}\iref{exec.snd.general}
3520+
is specialized for \tcode{bulk_t} as follows:
3521+
\begin{codeblock}
3522+
namespace std::execution {
3523+
template<>
3524+
struct @\exposid{impls-for}@<bulk_t> : @\exposid{default-impls}@ {
3525+
static constexpr auto @\exposid{complete}@ = @\seebelow@;
3526+
};
3527+
}
3528+
\end{codeblock}
3529+
3530+
\pnum
3531+
The member \tcode{\exposid{impls-for}<bulk_t>::\exposid{complete}}
3532+
is initialized with a callable object equivalent to the following lambda:
3533+
\begin{codeblock}
3534+
[]<class Index, class State, class Rcvr, class Tag, class... Args>
3535+
(Index, State& state, Rcvr& rcvr, Tag, Args&&... args) noexcept -> void requires @\seebelow@ {
3536+
if constexpr (@\libconcept{same_as}@<Tag, set_value_t>) {
3537+
auto& [shape, f] = state;
3538+
constexpr bool nothrow = noexcept(f(auto(shape), args...));
3539+
@\exposid{TRY-EVAL}@(rcvr, [&]() noexcept(nothrow) {
3540+
for (decltype(auto(shape)) i = 0; i < shape; ++i) {
3541+
f(auto(i), args...);
3542+
}
3543+
Tag()(std::move(rcvr), std::forward<Args>(args)...);
3544+
}());
3545+
} else {
3546+
Tag()(std::move(rcvr), std::forward<Args>(args)...);
3547+
}
3548+
}
3549+
\end{codeblock}
3550+
3551+
\pnum
3552+
The expression in the \grammarterm{requires-clause} of the lambda above
3553+
is \tcode{true} if and only
3554+
if \tcode{Tag} denotes a type other than \tcode{set_value_t} or
3555+
if the expression \tcode{f(auto(shape), args...)} is well-formed.
3556+
3557+
\pnum
3558+
Let the subexpression \tcode{out_sndr} denote
3559+
the result of the invocation \tcode{bulk(sndr, shape, f)} or
3560+
an object equal to such, and
3561+
let the subexpression \tcode{rcvr} denote a receiver
3562+
such that the expression \tcode{connect(out_sndr, rcvr)} is well-formed.
3563+
The expression \tcode{connect(out_sndr, rcvr)} has undefined behavior
3564+
unless it creates an asynchronous operation\iref{exec.async.ops} that,
3565+
when started,
3566+
\begin{itemize}
3567+
\item
3568+
on a value completion operation,
3569+
invokes \tcode{f(i, args...)}
3570+
for every \tcode{i} of type \tcode{Shape} from \tcode{0} to \tcode{shape},
3571+
where \tcode{args} is a pack of lvalue subexpressions
3572+
referring to the value completion result datums of the input sender, and
3573+
\item
3574+
propagates all completion operations sent by \tcode{sndr}.
3575+
\end{itemize}
3576+
34903577
\rSec1[exec.util]{Sender/receiver utilities}
34913578

34923579

0 commit comments

Comments
 (0)