|
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}@{};
|
|
1865 | 1867 | denoted by \tcode{\exposid{completion-signatures-for}<Sndr, Env>}
|
1866 | 1868 | to communicate to users why.
|
1867 | 1869 |
|
1868 |
| -\begin{itemdecl} |
1869 |
| -template<@\libconcept{sender}@ Sndr, @\exposconcept{queryable}@ Env> |
1870 |
| - constexpr auto @\exposid{write-env}@(Sndr&& sndr, Env&& env); // \expos |
1871 |
| -\end{itemdecl} |
1872 |
| - |
1873 |
| -\begin{itemdescr} |
1874 |
| -\pnum |
1875 |
| -\exposid{write-env} is an exposition-only sender adaptor that, |
1876 |
| -when connected with a receiver \tcode{rcvr}, |
1877 |
| -connects the adapted sender with a receiver |
1878 |
| -whose execution environment is the result of |
1879 |
| -joining the \exposconcept{queryable} argument \tcode{env} |
1880 |
| -to the result of \tcode{get_env(rcvr)}. |
1881 |
| - |
1882 |
| -\pnum |
1883 |
| -Let \exposid{write-env-t} be an exposition-only empty class type. |
1884 |
| - |
1885 |
| -\pnum |
1886 |
| -\returns |
1887 |
| -\begin{codeblock} |
1888 |
| -@\exposid{make-sender}@(@\exposid{write-env-t}@(), std::forward<Env>(env), std::forward<Sndr>(sndr)) |
1889 |
| -\end{codeblock} |
1890 |
| - |
1891 |
| -\pnum |
1892 |
| -\remarks |
1893 |
| -The exposition-only class template \exposid{impls-for}\iref{exec.snd.general} |
1894 |
| -is specialized for \exposid{write-env-t} as follows: |
1895 |
| -\begin{codeblock} |
1896 |
| -template<> |
1897 |
| -struct @\exposid{impls-for}@<@\exposid{write-env-t}@> : @\exposid{default-impls}@ { |
1898 |
| - static constexpr auto @\exposid{get-env}@ = |
1899 |
| - [](auto, const auto& state, const auto& rcvr) noexcept { |
1900 |
| - return @\seebelow@; |
1901 |
| - }; |
1902 |
| -}; |
1903 |
| -\end{codeblock} |
1904 |
| -Invocation of |
1905 |
| -\tcode{\exposid{impls-for}<\exposid{write-env-t}>::\exposid{get-env}} |
1906 |
| -returns an object \tcode{e} such that |
1907 |
| -\begin{itemize} |
1908 |
| -\item |
1909 |
| -\tcode{decltype(e)} models \exposconcept{queryable} and |
1910 |
| -\item |
1911 |
| -given a query object \tcode{q}, |
1912 |
| -the expression \tcode{e.query(q)} is expression-equivalent |
1913 |
| -to \tcode{state.query(q)} if that expression is valid, |
1914 |
| -otherwise, \tcode{e.query(q)} is expression-equivalent |
1915 |
| -to \tcode{get_env(rcvr).que\-ry(q)}. |
1916 |
| -\end{itemize} |
1917 |
| -\end{itemdescr} |
1918 |
| - |
1919 | 1870 | \rSec2[exec.snd.concepts]{Sender concepts}
|
1920 | 1871 |
|
1921 | 1872 | \pnum
|
|
2803 | 2754 | the initializations of the bound argument entities of the result,
|
2804 | 2755 | as specified above, are all well-formed.
|
2805 | 2756 |
|
| 2757 | +\rSec3[exec.write.env]{\tcode{execution::write_env}} |
| 2758 | + |
| 2759 | +\pnum |
| 2760 | +\tcode{write_env} is a sender adaptor |
| 2761 | +that accepts a sender and a queryable object, and |
| 2762 | +that returns a sender that, |
| 2763 | +when connected with a receiver \tcode{rcvr}, |
| 2764 | +connects the adapted sender with a receiver |
| 2765 | +whose execution environment is the result of |
| 2766 | +joining the \exposconcept{queryable} object |
| 2767 | +to the result of \tcode{get_env(rcvr)}. |
| 2768 | + |
| 2769 | +\pnum |
| 2770 | +\tcode{write_env} is a customization point object. |
| 2771 | +For some subexpressions \tcode{sndr} and \tcode{env}, |
| 2772 | +if \tcode{decltype((sndr))} does not satisfy \libconcept{sender} or |
| 2773 | +if \tcode{decltype((env))} does not satisfy \exposconcept{queryable}, |
| 2774 | +the expression \tcode{write_env(sndr, env)} is ill-formed. |
| 2775 | +Otherwise, it is expression-equivalent to |
| 2776 | +\tcode{\exposid{make-sender}(write_env, env, sndr)}. |
| 2777 | + |
| 2778 | +\pnum |
| 2779 | +Let \exposid{write-env-t} denote the type \tcode{decltype(auto(write_env))}. |
| 2780 | +The exposition-only class template \exposid{impls-for}\iref{exec.snd.general} |
| 2781 | +is specialized for \exposid{write-env-t} as follows: |
| 2782 | +\begin{codeblock} |
| 2783 | +template<> |
| 2784 | +struct @\exposid{impls-for}@<@\exposid{write-env-t}@> : @\exposid{default-impls}@ { |
| 2785 | + static constexpr auto @\exposid{get-env}@ = |
| 2786 | + [](auto, const auto& state, const auto& rcvr) noexcept { |
| 2787 | + return @\seebelow@; |
| 2788 | + }; |
| 2789 | +}; |
| 2790 | +\end{codeblock} |
| 2791 | +Invocation of |
| 2792 | +\tcode{\exposid{impls-for}<\exposid{write-env-t}>::\exposid{get-env}} |
| 2793 | +returns an object \tcode{e} such that |
| 2794 | +\begin{itemize} |
| 2795 | +\item |
| 2796 | +\tcode{decltype(e)} models \exposconcept{queryable} and |
| 2797 | +\item |
| 2798 | +given a query object \tcode{q}, |
| 2799 | +the expression \tcode{e.query(q)} is expression-equivalent |
| 2800 | +to \tcode{state.query(q)} if that expression is valid, |
| 2801 | +otherwise, \tcode{e.query(q)} is expression-equivalent |
| 2802 | +to \tcode{get_env(rcvr).que\-ry(q)}. |
| 2803 | +\end{itemize} |
| 2804 | + |
| 2805 | +\rSec3[exec.unstoppable]{\tcode{execution::unstoppable}} |
| 2806 | + |
| 2807 | +\pnum |
| 2808 | +\tcode{unstoppable} is a sender adaptor |
| 2809 | +that connects its inner sender |
| 2810 | +with a receiver that has the execution environment of the outer receiver |
| 2811 | +but with an object of type \tcode{never_stop_token} |
| 2812 | +as the result of the \tcode{get_stop_token query}. |
| 2813 | + |
| 2814 | +\pnum |
| 2815 | +For a subexpression \tcode{sndr}, |
| 2816 | +\tcode{unstoppable(sndr)} is expression-equivalent to |
| 2817 | +\tcode{write_env(sndr, prop(get_stop_token, never_stop_token\{\}))}. |
| 2818 | + |
2806 | 2819 | \rSec3[exec.starts.on]{\tcode{execution::starts_on}}
|
2807 | 2820 |
|
2808 | 2821 | \pnum
|
|
3243 | 3256 | if constexpr (@\libconcept{same_as}@<decltype(orig_sch), @\exposid{not-a-scheduler}@>) {
|
3244 | 3257 | return @\exposid{not-a-sender}@{};
|
3245 | 3258 | } else {
|
3246 |
| - return @\exposid{write-env}@( |
| 3259 | + return write_env( |
3247 | 3260 | continues_on(
|
3248 | 3261 | std::forward_like<OutSndr>(closure)(
|
3249 | 3262 | continues_on(
|
3250 |
| - @\exposid{write-env}@(std::forward_like<OutSndr>(child), @\exposid{SCHED-ENV}@(orig_sch)), |
| 3263 | + write_env(std::forward_like<OutSndr>(child), @\exposid{SCHED-ENV}@(orig_sch)), |
3251 | 3264 | sch)),
|
3252 | 3265 | orig_sch),
|
3253 | 3266 | @\exposid{SCHED-ENV}@(sch));
|
|
0 commit comments