|
1819 | 1819 | \begin{codeblock}
|
1820 | 1820 | []<class Sndr, class Rcvr>(Sndr&& sndr, Rcvr& rcvr) noexcept -> decltype(auto) {
|
1821 | 1821 | auto& [_, data, ...child] = sndr;
|
1822 |
| - return std::forward_like<Sndr>(data); |
| 1822 | + return @\exposid{allocator-aware-forward}@(std::forward_like<Sndr>(data), rcvr); |
1823 | 1823 | }
|
1824 | 1824 | \end{codeblock}
|
1825 | 1825 |
|
|
1916 | 1916 | \end{itemize}
|
1917 | 1917 | \end{itemdescr}
|
1918 | 1918 |
|
| 1919 | +\begin{itemdecl} |
| 1920 | +template<class T, class Context> |
| 1921 | +decltype(auto) @\exposid{allocator-aware-forward}@(T&& obj, Context&& context); // \expos |
| 1922 | +\end{itemdecl} |
| 1923 | + |
| 1924 | +\begin{itemdescr} |
| 1925 | +\pnum |
| 1926 | +\exposid{allocator-aware-forward} is an exposition-only function used to |
| 1927 | +either create a new object of type \tcode{T} from \tcode{obj} |
| 1928 | +or forward \tcode{obj} depending on whether an allocator is available. |
| 1929 | +If the environment associated with context provides an allocator |
| 1930 | +(i.e., the expression \tcode{get_allocator(get_env(context))} is valid, |
| 1931 | +let \exposid{alloc} be the result of this expression |
| 1932 | +and \tcode{P} be \tcode{remove_cvref_t<T>}. |
| 1933 | + |
| 1934 | +\pnum |
| 1935 | +\returns |
| 1936 | +\begin{itemize} |
| 1937 | +\item |
| 1938 | +If \exposid{alloc} is not defined, returns \tcode{std::forward<T>(obj)}, |
| 1939 | +\item |
| 1940 | +otherwise if \tcode{P} is a specialization of \exposid{product-type}, |
| 1941 | +returns an object of type \tcode{P} whose elements are initialized using |
| 1942 | +\tcode{make_obj_using_allocator<decltype(e)> (std::forward_like<T>(e), \exposid{alloc})} |
| 1943 | +where \tcode{e} is the corresponding element of \tcode{obj}, |
| 1944 | +\item |
| 1945 | +otherwise, returns \tcode{make_obj_using_allocator<P>(std::forward<T>(obj), \exposid{alloc})}. |
| 1946 | +\end{itemize} |
| 1947 | +\end{itemdescr} |
| 1948 | + |
1919 | 1949 | \rSec2[exec.snd.concepts]{Sender concepts}
|
1920 | 1950 |
|
1921 | 1951 | \pnum
|
|
3515 | 3545 | args_variant_t @\exposid{args}@; // \expos
|
3516 | 3546 | ops2_variant_t @\exposid{ops2}@; // \expos
|
3517 | 3547 | };
|
3518 |
| - return @\exposid{state-type}@{std::forward_like<Sndr>(fn), @\exposid{let-env}@(child), {}, {}}; |
| 3548 | + return @\exposid{state-type}@{@\exposid{allocator-aware-forward}@(std::forward_like<Sndr>(fn), rcvr), |
| 3549 | + @\exposid{let-env}@(child), {}, {}}; |
3519 | 3550 | }
|
3520 | 3551 | \end{codeblock}
|
3521 | 3552 |
|
|
0 commit comments