diff --git a/source/exec.tex b/source/exec.tex index 8fa3c30a24..131d5f103a 100644 --- a/source/exec.tex +++ b/source/exec.tex @@ -1819,7 +1819,7 @@ \begin{codeblock} [](Sndr&& sndr, Rcvr& rcvr) noexcept -> decltype(auto) { auto& [_, data, ...child] = sndr; - return std::forward_like(data); + return @\exposid{allocator-aware-forward}@(std::forward_like(data), rcvr); } \end{codeblock} @@ -1916,6 +1916,36 @@ \end{itemize} \end{itemdescr} +\begin{itemdecl} +template +decltype(auto) @\exposid{allocator-aware-forward}@(T&& obj, Context&& context); // \expos +\end{itemdecl} + +\begin{itemdescr} +\pnum +\exposid{allocator-aware-forward} is an exposition-only function used to +either create a new object of type \tcode{T} from \tcode{obj} +or forward \tcode{obj} depending on whether an allocator is available. +If the environment associated with context provides an allocator +(i.e., the expression \tcode{get_allocator(get_env(context))} is valid, +let \exposid{alloc} be the result of this expression +and \tcode{P} be \tcode{remove_cvref_t}. + +\pnum +\returns +\begin{itemize} +\item +If \exposid{alloc} is not defined, returns \tcode{std::forward(obj)}, +\item +otherwise if \tcode{P} is a specialization of \exposid{product-type}, +returns an object of type \tcode{P} whose elements are initialized using +\tcode{make_obj_using_allocator (std::forward_like(e), \exposid{alloc})} +where \tcode{e} is the corresponding element of \tcode{obj}, +\item +otherwise, returns \tcode{make_obj_using_allocator

(std::forward(obj), \exposid{alloc})}. +\end{itemize} +\end{itemdescr} + \rSec2[exec.snd.concepts]{Sender concepts} \pnum @@ -3515,7 +3545,8 @@ args_variant_t @\exposid{args}@; // \expos ops2_variant_t @\exposid{ops2}@; // \expos }; - return @\exposid{state-type}@{std::forward_like(fn), @\exposid{let-env}@(child), {}, {}}; + return @\exposid{state-type}@{@\exposid{allocator-aware-forward}@(std::forward_like(fn), rcvr), + @\exposid{let-env}@(child), {}, {}}; } \end{codeblock}