|
636 | 636 | struct @\libglobal{stopped_as_optional_t}@ { @\unspec@ }; |
637 | 637 | struct @\libglobal{stopped_as_error_t}@ { @\unspec@ }; |
638 | 638 |
|
| 639 | + inline constexpr @\unspec@ @\libglobal{write_env}@{}; |
| 640 | + inline constexpr @\unspec@ @\libglobal{unstoppable}@{}; |
639 | 641 | inline constexpr starts_on_t @\libglobal{starts_on}@{}; |
640 | 642 | inline constexpr continues_on_t @\libglobal{continues_on}@{}; |
641 | 643 | inline constexpr on_t @\libglobal{on}@{}; |
|
1866 | 1868 | denoted by \tcode{\exposid{completion-signatures-for}<Sndr, Env>} |
1867 | 1869 | to communicate to users why. |
1868 | 1870 |
|
1869 | | -\begin{itemdecl} |
1870 | | -template<@\libconcept{sender}@ Sndr, @\exposconcept{queryable}@ Env> |
1871 | | - constexpr auto @\exposid{write-env}@(Sndr&& sndr, Env&& env); // \expos |
1872 | | -\end{itemdecl} |
1873 | | - |
1874 | | -\begin{itemdescr} |
1875 | | -\pnum |
1876 | | -\exposid{write-env} is an exposition-only sender adaptor that, |
1877 | | -when connected with a receiver \tcode{rcvr}, |
1878 | | -connects the adapted sender with a receiver |
1879 | | -whose execution environment is the result of |
1880 | | -joining the \exposconcept{queryable} argument \tcode{env} |
1881 | | -to the result of \tcode{get_env(rcvr)}. |
1882 | | - |
1883 | | -\pnum |
1884 | | -Let \exposid{write-env-t} be an exposition-only empty class type. |
1885 | | - |
1886 | | -\pnum |
1887 | | -\returns |
1888 | | -\begin{codeblock} |
1889 | | -@\exposid{make-sender}@(@\exposid{write-env-t}@(), std::forward<Env>(env), std::forward<Sndr>(sndr)) |
1890 | | -\end{codeblock} |
1891 | | - |
1892 | | -\pnum |
1893 | | -\remarks |
1894 | | -The exposition-only class template \exposid{impls-for}\iref{exec.snd.general} |
1895 | | -is specialized for \exposid{write-env-t} as follows: |
1896 | | -\begin{codeblock} |
1897 | | -template<> |
1898 | | -struct @\exposid{impls-for}@<@\exposid{write-env-t}@> : @\exposid{default-impls}@ { |
1899 | | - static constexpr auto @\exposid{get-env}@ = |
1900 | | - [](auto, const auto& state, const auto& rcvr) noexcept { |
1901 | | - return @\seebelow@; |
1902 | | - }; |
1903 | | -}; |
1904 | | -\end{codeblock} |
1905 | | -Invocation of |
1906 | | -\tcode{\exposid{impls-for}<\exposid{write-env-t}>::\exposid{get-env}} |
1907 | | -returns an object \tcode{e} such that |
1908 | | -\begin{itemize} |
1909 | | -\item |
1910 | | -\tcode{decltype(e)} models \exposconcept{queryable} and |
1911 | | -\item |
1912 | | -given a query object \tcode{q}, |
1913 | | -the expression \tcode{e.query(q)} is expression-equivalent |
1914 | | -to \tcode{state.query(q)} if that expression is valid, |
1915 | | -otherwise, \tcode{e.query(q)} is expression-equivalent |
1916 | | -to \tcode{get_env(rcvr).que\-ry(q)}. |
1917 | | -\end{itemize} |
1918 | | -\end{itemdescr} |
1919 | | - |
1920 | 1871 | \rSec2[exec.snd.concepts]{Sender concepts} |
1921 | 1872 |
|
1922 | 1873 | \pnum |
|
2822 | 2773 | the initializations of the bound argument entities of the result, |
2823 | 2774 | as specified above, are all well-formed. |
2824 | 2775 |
|
| 2776 | +\rSec3[exec.write.env]{\tcode{execution::write_env}} |
| 2777 | + |
| 2778 | +\pnum |
| 2779 | +\tcode{write_env} is a sender adaptor |
| 2780 | +that accepts a sender and a queryable object, and |
| 2781 | +that returns a sender that, |
| 2782 | +when connected with a receiver \tcode{rcvr}, |
| 2783 | +connects the adapted sender with a receiver |
| 2784 | +whose execution environment is the result of |
| 2785 | +joining the \exposconcept{queryable} object |
| 2786 | +to the result of \tcode{get_env(rcvr)}. |
| 2787 | + |
| 2788 | +\pnum |
| 2789 | +\tcode{write_env} is a customization point object. |
| 2790 | +For some subexpressions \tcode{sndr} and \tcode{env}, |
| 2791 | +if \tcode{decltype((sndr))} does not satisfy \libconcept{sender} or |
| 2792 | +if \tcode{decltype((env))} does not satisfy \exposconcept{queryable}, |
| 2793 | +the expression \tcode{write_env(sndr, env)} is ill-formed. |
| 2794 | +Otherwise, it is expression-equivalent to |
| 2795 | +\tcode{\exposid{make-sender}(write_env, env, sndr)}. |
| 2796 | + |
| 2797 | +\pnum |
| 2798 | +Let \exposid{write-env-t} denote the type \tcode{decltype(auto(write_env))}. |
| 2799 | +The exposition-only class template \exposid{impls-for}\iref{exec.snd.general} |
| 2800 | +is specialized for \exposid{write-env-t} as follows: |
| 2801 | +\begin{codeblock} |
| 2802 | +template<> |
| 2803 | +struct @\exposid{impls-for}@<@\exposid{write-env-t}@> : @\exposid{default-impls}@ { |
| 2804 | + static constexpr auto @\exposid{get-env}@ = |
| 2805 | + [](auto, const auto& state, const auto& rcvr) noexcept { |
| 2806 | + return @\seebelow@; |
| 2807 | + }; |
| 2808 | +}; |
| 2809 | +\end{codeblock} |
| 2810 | +Invocation of |
| 2811 | +\tcode{\exposid{impls-for}<\exposid{write-env-t}>::\exposid{get-env}} |
| 2812 | +returns an object \tcode{e} such that |
| 2813 | +\begin{itemize} |
| 2814 | +\item |
| 2815 | +\tcode{decltype(e)} models \exposconcept{queryable} and |
| 2816 | +\item |
| 2817 | +given a query object \tcode{q}, |
| 2818 | +the expression \tcode{e.query(q)} is expression-equivalent |
| 2819 | +to \tcode{state.query(q)} if that expression is valid, |
| 2820 | +otherwise, \tcode{e.query(q)} is expression-equivalent |
| 2821 | +to \tcode{get_env(rcvr).que\-ry(q)}. |
| 2822 | +\end{itemize} |
| 2823 | + |
| 2824 | +\rSec3[exec.unstoppable]{\tcode{execution::unstoppable}} |
| 2825 | + |
| 2826 | +\pnum |
| 2827 | +\tcode{unstoppable} is a sender adaptor |
| 2828 | +that connects its inner sender |
| 2829 | +with a receiver that has the execution environment of the outer receiver |
| 2830 | +but with an object of type \tcode{never_stop_token} |
| 2831 | +as the result of the \tcode{get_stop_token query}. |
| 2832 | + |
| 2833 | +\pnum |
| 2834 | +For a subexpression \tcode{sndr}, |
| 2835 | +\tcode{unstoppable(sndr)} is expression-equivalent to |
| 2836 | +\tcode{write_env(sndr, prop(get_stop_token, never_stop_token\{\}))}. |
| 2837 | + |
2825 | 2838 | \rSec3[exec.starts.on]{\tcode{execution::starts_on}} |
2826 | 2839 |
|
2827 | 2840 | \pnum |
|
3269 | 3282 | if constexpr (@\libconcept{same_as}@<decltype(orig_sch), @\exposid{not-a-scheduler}@>) { |
3270 | 3283 | return @\exposid{not-a-sender}@{}; |
3271 | 3284 | } else { |
3272 | | - return @\exposid{write-env}@( |
| 3285 | + return write_env( |
3273 | 3286 | continues_on( |
3274 | 3287 | std::forward_like<OutSndr>(closure)( |
3275 | 3288 | continues_on( |
3276 | | - @\exposid{write-env}@(std::forward_like<OutSndr>(child), @\exposid{SCHED-ENV}@(orig_sch)), |
| 3289 | + write_env(std::forward_like<OutSndr>(child), @\exposid{SCHED-ENV}@(orig_sch)), |
3277 | 3290 | sch)), |
3278 | 3291 | orig_sch), |
3279 | 3292 | @\exposid{SCHED-ENV}@(sch)); |
|
0 commit comments