Skip to content

Commit 0d58c98

Browse files
committed
[exec.snd.expos] Break up long code block.
The smaller pieces are interspersed into the relevant parts of the body text, and each piece is given a \pnum. Fixes NB US 213-353 (C++26 CD).
1 parent e1ee86a commit 0d58c98

1 file changed

Lines changed: 180 additions & 152 deletions

File tree

source/exec.tex

Lines changed: 180 additions & 152 deletions
Original file line numberDiff line numberDiff line change
@@ -1732,12 +1732,33 @@
17321732
that models \libconcept{semiregular}.
17331733
\end{itemdescr}
17341734

1735+
\pnum
1736+
Let \defexposconceptnc{completion-tag} be the following concept:
17351737
\begin{codeblock}
17361738
namespace std::execution {
17371739
template<class Tag>
1738-
concept @\defexposconceptnc{completion-tag}@ = // \expos
1740+
concept @\defexposconceptnc{completion-tag}@ = // \expos
17391741
@\libconcept{same_as}@<Tag, set_value_t> || @\libconcept{same_as}@<Tag, set_error_t> || @\libconcept{same_as}@<Tag, set_stopped_t>;
1742+
}
1743+
\end{codeblock}
1744+
1745+
\pnum
1746+
\begin{codeblock}
1747+
namespace std::execution {
1748+
template<class Sndr>
1749+
using @\exposidnc{data-type}@ = decltype(declval<Sndr>().template @\exposidnc{get}@<1>()); // \expos
1750+
1751+
template<class Sndr, size_t I = 0>
1752+
using @\exposidnc{child-type}@ = decltype(declval<Sndr>().template @\exposidnc{get}@<I+2>()); // \expos
17401753

1754+
template<class Sndr>
1755+
using @\exposidnc{indices-for}@ = remove_reference_t<Sndr>::@\exposidnc{indices-for}@; // \expos
1756+
}
1757+
\end{codeblock}
1758+
1759+
\pnum
1760+
\begin{codeblock}
1761+
namespace std::execution {
17411762
struct @\exposidnc{default-impls}@ { // \expos
17421763
static constexpr auto @\exposidnc{get-attrs}@ = @\seebelownc@; // \expos
17431764
static constexpr auto @\exposidnc{get-env}@ = @\seebelownc@; // \expos
@@ -1750,25 +1771,103 @@
17501771
};
17511772

17521773
template<class Tag>
1753-
struct @\exposidnc{impls-for}@ : @\exposidnc{default-impls}@ {}; // \expos
1774+
struct @\exposidnc{impls-for}@ : @\exposidnc{default-impls}@ {}; // \expos
1775+
}
1776+
\end{codeblock}
17541777

1755-
template<class Sndr, class Rcvr> // \expos
1756-
using @\exposid{state-type}@ = decay_t<@\exposid{call-result-t}@<
1757-
decltype(@\exposid{impls-for}@<tag_of_t<Sndr>>::@\exposid{get-state}@), Sndr, Rcvr&>>;
1778+
\pnum
1779+
The member \tcode{\exposid{default-impls}::\exposid{get-attrs}}
1780+
is initialized with a callable object equivalent to the following lambda:
1781+
\begin{codeblock}
1782+
[](const auto&, const auto&... child) noexcept -> decltype(auto) {
1783+
if constexpr (sizeof...(child) == 1)
1784+
return (@\exposid{FWD-ENV}@(get_env(child)), ...);
1785+
else
1786+
return env<>();
1787+
}
1788+
\end{codeblock}
17581789

1759-
template<class Index, class Sndr, class Rcvr> // \expos
1760-
using @\exposid{env-type}@ = @\exposid{call-result-t}@<
1761-
decltype(@\exposid{impls-for}@<tag_of_t<Sndr>>::@\exposid{get-env}@), Index,
1762-
@\exposid{state-type}@<Sndr, Rcvr>&, const Rcvr&>;
1790+
\pnum
1791+
The member \tcode{\exposid{default-impls}::\exposid{get-env}}
1792+
is initialized with a callable object equivalent to the following lambda:
1793+
\begin{codeblock}
1794+
[](auto, auto&, const auto& rcvr) noexcept -> decltype(auto) {
1795+
return @\exposid{FWD-ENV}@(get_env(rcvr));
1796+
}
1797+
\end{codeblock}
17631798

1764-
template<class Sndr>
1765-
using @\exposidnc{data-type}@ = decltype(declval<Sndr>().template @\exposidnc{get}@<1>()); // \expos
1799+
\pnum
1800+
The member \tcode{\exposid{default-impls}::\exposid{get-state}}
1801+
is initialized with a callable object equivalent to the following lambda:
1802+
\begin{codeblock}
1803+
[]<class Sndr, class Rcvr>(Sndr&& sndr, Rcvr& rcvr) noexcept -> decltype(auto) {
1804+
auto& [_, data, ...child] = sndr;
1805+
return @\exposid{allocator-aware-forward}@(std::forward_like<Sndr>(data), rcvr);
1806+
}
1807+
\end{codeblock}
17661808

1767-
template<class Sndr, size_t I = 0>
1768-
using @\exposidnc{child-type}@ = decltype(declval<Sndr>().template @\exposidnc{get}@<I+2>()); // \expos
1809+
\pnum
1810+
The member \tcode{\exposid{default-impls}::\exposid{start}}
1811+
is initialized with a callable object equivalent to the following lambda:
1812+
\begin{codeblock}
1813+
[](auto&, auto&, auto&... ops) noexcept -> void {
1814+
(execution::start(ops), ...);
1815+
}
1816+
\end{codeblock}
17691817

1770-
template<class Sndr>
1771-
using @\exposidnc{indices-for}@ = remove_reference_t<Sndr>::@\exposidnc{indices-for}@; // \expos
1818+
\pnum
1819+
The member \tcode{\exposid{default-impls}::\exposid{complete}}
1820+
is initialized with a callable object equivalent to the following lambda:
1821+
\begin{codeblock}
1822+
[]<class Index, class Rcvr, class Tag, class... Args>(
1823+
Index, auto& state, Rcvr& rcvr, Tag, Args&&... args) noexcept
1824+
-> void requires @\exposconcept{callable}@<Tag, Rcvr, Args...> {
1825+
static_assert(Index::value == 0);
1826+
Tag()(std::move(rcvr), std::forward<Args>(args)...);
1827+
}
1828+
\end{codeblock}
1829+
1830+
\indexlibrarymember{\exposid{check-types}}{\exposid{default-impls}}%
1831+
\begin{itemdecl}
1832+
template<class Sndr, class... Env>
1833+
static consteval void @\exposid{default-impls}@::@\exposid{check-types}@();
1834+
\end{itemdecl}
1835+
1836+
\begin{itemdescr}
1837+
\pnum
1838+
Let \tcode{Is} be the pack of integral template arguments of
1839+
the \tcode{integer_sequence} specialization denoted by
1840+
\tcode{\exposid{indices-for}<Sndr>}.
1841+
1842+
\pnum
1843+
\effects
1844+
Equivalent to:
1845+
\begin{codeblock}
1846+
((void)get_completion_signatures<@\exposid{child-type}@<Sndr, Is>, @\exposid{FWD-ENV-T}@(Env)...>(), ...);
1847+
\end{codeblock}
1848+
1849+
\pnum
1850+
\begin{note}
1851+
For any types \tcode{T} and \tcode{S}, and pack \tcode{E},
1852+
let \tcode{e} be the expression
1853+
\tcode{\exposid{impls-for}<T>::\exposid{check-types}<S, E...>()}.
1854+
Then exactly one of the following is \tcode{true}:
1855+
\begin{itemize}
1856+
\item \tcode{e} is ill-formed, or
1857+
\item the evaluation of \tcode{e} exits with an exception, or
1858+
\item \tcode{e} is a core constant expression.
1859+
\end{itemize}
1860+
When \tcode{e} is a core constant expression,
1861+
the pack \tcode{S, E...} uniquely determines a set of completion signatures.
1862+
\end{note}
1863+
\end{itemdescr}
1864+
1865+
\pnum
1866+
\begin{codeblock}
1867+
namespace std::execution {
1868+
template<class Sndr, class Rcvr> // \expos
1869+
using @\exposid{state-type}@ = decay_t<@\exposid{call-result-t}@<
1870+
decltype(@\exposid{impls-for}@<tag_of_t<Sndr>>::@\exposid{get-state}@), Sndr, Rcvr&>>;
17721871

17731872
template<class Sndr, class Rcvr>
17741873
struct @\exposidnc{basic-state}@ { // \expos
@@ -1779,46 +1878,26 @@
17791878
Rcvr @\exposidnc{rcvr}@; // \expos
17801879
@\exposidnc{state-type}@<Sndr, Rcvr> @\exposidnc{state}@; // \expos
17811880
};
1881+
}
1882+
\end{codeblock}
17821883

1783-
template<class Sndr, class Rcvr, class Index>
1784-
requires @\exposconcept{valid-specialization}@<@\exposid{env-type}@, Index, Sndr, Rcvr>
1785-
struct @\exposidnc{basic-receiver}@ { // \expos
1786-
using receiver_concept = receiver_t;
1787-
1788-
using @\exposidnc{tag-t}@ = tag_of_t<Sndr>; // \expos
1789-
using @\exposidnc{state-t}@ = @\exposidnc{state-type}@<Sndr, Rcvr>; // \expos
1790-
static constexpr const auto& @\exposidnc{complete}@ = @\exposidnc{impls-for}@<@\exposidnc{tag-t}@>::@\exposidnc{complete}@; // \expos
1791-
1792-
template<class... Args>
1793-
requires @\exposconcept{callable}@<decltype(@\exposid{complete}@), Index, @\exposid{state-t}@&, Rcvr&, set_value_t, Args...>
1794-
void set_value(Args&&... args) && noexcept {
1795-
@\exposid{complete}@(Index(), @\exposidnc{op}@->@\exposid{state}@, @\exposidnc{op}@->@\exposid{rcvr}@, set_value_t(), std::forward<Args>(args)...);
1796-
}
1797-
1798-
template<class Error>
1799-
requires @\exposconcept{callable}@<decltype(@\exposid{complete}@), Index, @\exposid{state-t}@&, Rcvr&, set_error_t, Error>
1800-
void set_error(Error&& err) && noexcept {
1801-
@\exposid{complete}@(Index(), @\exposidnc{op}@->@\exposid{state}@, @\exposidnc{op}@->@\exposid{rcvr}@, set_error_t(), std::forward<Error>(err));
1802-
}
1803-
1804-
void set_stopped() && noexcept
1805-
requires @\exposconcept{callable}@<decltype(@\exposid{complete}@), Index, @\exposid{state-t}@&, Rcvr&, set_stopped_t> {
1806-
@\exposid{complete}@(Index(), @\exposidnc{op}@->@\exposid{state}@, @\exposidnc{op}@->@\exposid{rcvr}@, set_stopped_t());
1807-
}
1808-
1809-
auto get_env() const noexcept -> @\exposid{env-type}@<Index, Sndr, Rcvr> {
1810-
return @\exposid{impls-for}@<@\exposid{tag-t}@>::@\exposid{get-env}@(Index(), @\exposidnc{op}@->@\exposid{state}@, @\exposidnc{op}@->@\exposid{rcvr}@);
1811-
}
1812-
1813-
@\exposidnc{basic-state}@<Sndr, Rcvr>* @\exposidnc{op}@; // \expos
1814-
};
1815-
1816-
constexpr auto @\exposidnc{connect-all}@ = @\seebelownc@; // \expos
1817-
1818-
template<class Sndr, class Rcvr>
1819-
using @\exposidnc{connect-all-result}@ = @\exposidnc{call-result-t}@< // \expos
1820-
decltype(@\exposid{connect-all}@), @\exposid{basic-state}@<Sndr, Rcvr>*, Sndr, @\exposid{indices-for}@<Sndr>>;
1884+
\pnum
1885+
The expression in the \tcode{noexcept} clause of
1886+
the constructor of \exposid{basic-state} is
1887+
\begin{codeblock}
1888+
is_nothrow_move_constructible_v<Rcvr> &&
1889+
@\exposconcept{nothrow-callable}@<decltype(@\exposid{impls-for}@<tag_of_t<Sndr>>::@\exposid{get-state}@), Sndr, Rcvr&> &&
1890+
(@\libconcept{same_as}@<@\exposid{state-type}@<Sndr, Rcvr>, @\exposid{get-state-result}@> ||
1891+
is_nothrow_constructible_v<@\exposid{state-type}@<Sndr, Rcvr>, @\exposid{get-state-result}@>)
1892+
\end{codeblock}
1893+
where \exposid{get-state-result} is
1894+
\begin{codeblock}
1895+
@\exposid{call-result-t}@<decltype(@\exposid{impls-for}@<tag_of_t<Sndr>>::@\exposid{get-state}@), Sndr, Rcvr&>.
1896+
\end{codeblock}
18211897

1898+
\pnum
1899+
\begin{codeblock}
1900+
namespace std::execution {
18221901
template<class Sndr, class Rcvr>
18231902
requires @\exposconcept{valid-specialization}@<@\exposid{state-type}@, Sndr, Rcvr> &&
18241903
@\exposconcept{valid-specialization}@<@\exposid{connect-all-result}@, Sndr, Rcvr>
@@ -1850,13 +1929,13 @@
18501929
}
18511930

18521931
template<@\exposconcept{decays-to}@<@\exposid{basic-sender}@> Self, @\libconcept{receiver}@ Rcvr>
1853-
auto connect(this Self&& self, Rcvr rcvr) noexcept(@\seebelow@)
1932+
auto connect(this Self&& self, Rcvr rcvr) noexcept(@\seebelow@)
18541933
-> @\exposid{basic-operation}@<Self, Rcvr> {
18551934
return {std::forward<Self>(self), std::move(rcvr)};
18561935
}
18571936

18581937
template<@\exposconcept{decays-to}@<@\exposid{basic-sender}@> Self, class... Env>
1859-
static constexpr auto get_completion_signatures();
1938+
static constexpr auto get_completion_signatures();
18601939
};
18611940
}
18621941
\end{codeblock}
@@ -1870,17 +1949,53 @@
18701949
the initializer of a structured binding declaration\iref{dcl.struct.bind}.
18711950

18721951
\pnum
1873-
The expression in the \tcode{noexcept} clause of
1874-
the constructor of \exposid{basic-state} is
1875-
\begin{codeblock}
1876-
is_nothrow_move_constructible_v<Rcvr> &&
1877-
@\exposconcept{nothrow-callable}@<decltype(@\exposid{impls-for}@<tag_of_t<Sndr>>::@\exposid{get-state}@), Sndr, Rcvr&> &&
1878-
(@\libconcept{same_as}@<@\exposid{state-type}@<Sndr, Rcvr>, @\exposid{get-state-result}@> ||
1879-
is_nothrow_constructible_v<@\exposid{state-type}@<Sndr, Rcvr>, @\exposid{get-state-result}@>)
1880-
\end{codeblock}
1881-
where \exposid{get-state-result} is
18821952
\begin{codeblock}
1883-
@\exposid{call-result-t}@<decltype(@\exposid{impls-for}@<tag_of_t<Sndr>>::@\exposid{get-state}@), Sndr, Rcvr&>.
1953+
namespace std::execution {
1954+
template<class Index, class Sndr, class Rcvr> // \expos
1955+
using @\exposid{env-type}@ = @\exposid{call-result-t}@<
1956+
decltype(@\exposid{impls-for}@<tag_of_t<Sndr>>::@\exposid{get-env}@), Index,
1957+
@\exposid{state-type}@<Sndr, Rcvr>&, const Rcvr&>;
1958+
1959+
constexpr auto @\exposidnc{connect-all}@ = @\seebelownc@; // \expos
1960+
1961+
template<class Sndr, class Rcvr>
1962+
using @\exposidnc{connect-all-result}@ = @\exposidnc{call-result-t}@< // \expos
1963+
decltype(@\exposid{connect-all}@), @\exposid{basic-state}@<Sndr, Rcvr>*, Sndr, @\exposid{indices-for}@<Sndr>>;
1964+
1965+
template<class Sndr, class Rcvr, class Index>
1966+
requires @\exposconcept{valid-specialization}@<@\exposid{env-type}@, Index, Sndr, Rcvr>
1967+
struct @\exposidnc{basic-receiver}@ { // \expos
1968+
using receiver_concept = receiver_t;
1969+
1970+
using @\exposidnc{tag-t}@ = tag_of_t<Sndr>; // \expos
1971+
using @\exposidnc{state-t}@ = @\exposidnc{state-type}@<Sndr, Rcvr>; // \expos
1972+
static constexpr const auto& @\exposidnc{complete}@ = @\exposidnc{impls-for}@<@\exposidnc{tag-t}@>::@\exposidnc{complete}@; // \expos
1973+
1974+
template<class... Args>
1975+
requires @\exposconcept{callable}@<decltype(@\exposid{complete}@), Index, @\exposid{state-t}@&, Rcvr&, set_value_t, Args...>
1976+
void set_value(Args&&... args) && noexcept {
1977+
@\exposid{complete}@(Index(), @\exposidnc{op}@->@\exposid{state}@, @\exposidnc{op}@->@\exposid{rcvr}@, set_value_t(), std::forward<Args>(args)...);
1978+
}
1979+
1980+
template<class Error>
1981+
requires @\exposconcept{callable}@<decltype(@\exposid{complete}@), Index, @\exposid{state-t}@&, Rcvr&, set_error_t, Error>
1982+
void set_error(Error&& err) && noexcept {
1983+
@\exposid{complete}@(Index(), @\exposidnc{op}@->@\exposid{state}@, @\exposidnc{op}@->@\exposid{rcvr}@, set_error_t(), std::forward<Error>(err));
1984+
}
1985+
1986+
void set_stopped() && noexcept
1987+
requires @\exposconcept{callable}@<decltype(@\exposid{complete}@), Index, @\exposid{state-t}@&, Rcvr&, set_stopped_t> {
1988+
@\exposid{complete}@(Index(), @\exposidnc{op}@->@\exposid{state}@, @\exposidnc{op}@->@\exposid{rcvr}@, set_stopped_t());
1989+
}
1990+
1991+
auto get_env() const noexcept -> @\exposid{env-type}@<Index, Sndr, Rcvr> {
1992+
return @\exposid{impls-for}@<@\exposid{tag-t}@>::@\exposid{get-env}@(Index(), @\exposidnc{op}@->@\exposid{state}@, @\exposidnc{op}@->@\exposid{rcvr}@);
1993+
}
1994+
1995+
@\exposidnc{basic-state}@<Sndr, Rcvr>* @\exposidnc{op}@; // \expos
1996+
};
1997+
1998+
}
18841999
\end{codeblock}
18852000

18862001
\pnum
@@ -1924,93 +2039,6 @@
19242039
is_nothrow_constructible_v<@\exposid{basic-operation}@<Self, Rcvr>, Self, Rcvr>
19252040
\end{codeblock}
19262041

1927-
\pnum
1928-
The member \tcode{\exposid{default-impls}::\exposid{get-attrs}}
1929-
is initialized with a callable object equivalent to the following lambda:
1930-
\begin{codeblock}
1931-
[](const auto&, const auto&... child) noexcept -> decltype(auto) {
1932-
if constexpr (sizeof...(child) == 1)
1933-
return (@\exposid{FWD-ENV}@(get_env(child)), ...);
1934-
else
1935-
return env<>();
1936-
}
1937-
\end{codeblock}
1938-
1939-
\pnum
1940-
The member \tcode{\exposid{default-impls}::\exposid{get-env}}
1941-
is initialized with a callable object equivalent to the following lambda:
1942-
\begin{codeblock}
1943-
[](auto, auto&, const auto& rcvr) noexcept -> decltype(auto) {
1944-
return @\exposid{FWD-ENV}@(get_env(rcvr));
1945-
}
1946-
\end{codeblock}
1947-
1948-
\pnum
1949-
The member \tcode{\exposid{default-impls}::\exposid{get-state}}
1950-
is initialized with a callable object equivalent to the following lambda:
1951-
\begin{codeblock}
1952-
[]<class Sndr, class Rcvr>(Sndr&& sndr, Rcvr& rcvr) noexcept -> decltype(auto) {
1953-
auto& [_, data, ...child] = sndr;
1954-
return @\exposid{allocator-aware-forward}@(std::forward_like<Sndr>(data), rcvr);
1955-
}
1956-
\end{codeblock}
1957-
1958-
\pnum
1959-
The member \tcode{\exposid{default-impls}::\exposid{start}}
1960-
is initialized with a callable object equivalent to the following lambda:
1961-
\begin{codeblock}
1962-
[](auto&, auto&, auto&... ops) noexcept -> void {
1963-
(execution::start(ops), ...);
1964-
}
1965-
\end{codeblock}
1966-
1967-
\pnum
1968-
The member \tcode{\exposid{default-impls}::\exposid{complete}}
1969-
is initialized with a callable object equivalent to the following lambda:
1970-
\begin{codeblock}
1971-
[]<class Index, class Rcvr, class Tag, class... Args>(
1972-
Index, auto& state, Rcvr& rcvr, Tag, Args&&... args) noexcept
1973-
-> void requires @\exposconcept{callable}@<Tag, Rcvr, Args...> {
1974-
static_assert(Index::value == 0);
1975-
Tag()(std::move(rcvr), std::forward<Args>(args)...);
1976-
}
1977-
\end{codeblock}
1978-
1979-
\indexlibrarymember{\exposid{check-types}}{\exposid{default-impls}}%
1980-
\begin{itemdecl}
1981-
template<class Sndr, class... Env>
1982-
static consteval void @\exposid{default-impls}@::@\exposid{check-types}@();
1983-
\end{itemdecl}
1984-
1985-
\begin{itemdescr}
1986-
\pnum
1987-
Let \tcode{Is} be the pack of integral template arguments of
1988-
the \tcode{integer_sequence} specialization denoted by
1989-
\tcode{\exposid{indices-for}<Sndr>}.
1990-
1991-
\pnum
1992-
\effects
1993-
Equivalent to:
1994-
\begin{codeblock}
1995-
((void)get_completion_signatures<@\exposid{child-type}@<Sndr, Is>, @\exposid{FWD-ENV-T}@(Env)...>(), ...);
1996-
\end{codeblock}
1997-
1998-
\pnum
1999-
\begin{note}
2000-
For any types \tcode{T} and \tcode{S}, and pack \tcode{E},
2001-
let \tcode{e} be the expression
2002-
\tcode{\exposid{impls-for}<T>::\exposid{check-types}<S, E...>()}.
2003-
Then exactly one of the following is \tcode{true}:
2004-
\begin{itemize}
2005-
\item \tcode{e} is ill-formed, or
2006-
\item the evaluation of \tcode{e} exits with an exception, or
2007-
\item \tcode{e} is a core constant expression.
2008-
\end{itemize}
2009-
When \tcode{e} is a core constant expression,
2010-
the pack \tcode{S, E...} uniquely determines a set of completion signatures.
2011-
\end{note}
2012-
\end{itemdescr}
2013-
20142042
\indexlibrarymember{get_completion_signatures}{\exposid{basic-sender}}%
20152043
\begin{itemdecl}
20162044
template<class Tag, class Data, class... Child>

0 commit comments

Comments
 (0)