|
372 | 372 | The type of the receiver does not affect
|
373 | 373 | an asynchronous operation's completion signatures,
|
374 | 374 | only the type of the receiver's environment.
|
| 375 | +A \defnadj{non-dependent}{sender} is a sender type |
| 376 | +whose completion signatures are knowable |
| 377 | +independent of an execution environment. |
375 | 378 |
|
376 | 379 | \pnum
|
377 | 380 | A sender algorithm is a function that takes and/or returns a sender.
|
|
528 | 531 | template<class Sndr>
|
529 | 532 | concept @\libconcept{sender}@ = @\seebelow@;
|
530 | 533 |
|
531 |
| - template<class Sndr, class Env = env<>> |
| 534 | + template<class Sndr, class Env> |
532 | 535 | concept @\libconcept{sender_in}@ = @\seebelow@;
|
533 | 536 |
|
| 537 | + template<class Sndr> |
| 538 | + concept @\libconcept{dependent_sender}@ = @\seebelow@; |
| 539 | + |
534 | 540 | template<class Sndr, class Rcvr>
|
535 | 541 | concept @\libconcept{sender_to}@ = @\seebelow@;
|
536 | 542 |
|
537 | 543 | template<class... Ts>
|
538 | 544 | struct @\exposidnc{type-list}@; // \expos
|
539 | 545 |
|
540 |
| - // \ref{exec.getcomplsigs}, completion signatures |
541 |
| - struct get_completion_signatures_t; |
542 |
| - inline constexpr get_completion_signatures_t get_completion_signatures {}; |
543 |
| - |
544 |
| - template<class Sndr, class Env = env<>> |
545 |
| - requires @\libconcept{sender_in}@<Sndr, Env> |
546 |
| - using completion_signatures_of_t = @\exposid{call-result-t}@<get_completion_signatures_t, Sndr, Env>; |
547 |
| - |
548 | 546 | template<class... Ts>
|
549 | 547 | using @\exposidnc{decayed-tuple}@ = tuple<decay_t<Ts>...>; // \expos
|
550 | 548 |
|
|
655 | 653 | inline constexpr stopped_as_error_t @\libglobal{stopped_as_error}@{};
|
656 | 654 |
|
657 | 655 | // \ref{exec.util}, sender and receiver utilities
|
658 |
| - // \ref{exec.util.cmplsig} |
| 656 | + // \ref{exec.util.cmplsig}, completion signatures |
659 | 657 | template<class Fn>
|
660 | 658 | concept @\exposconceptnc{completion-signature}@ = @\seebelownc@; // \expos
|
661 | 659 |
|
|
665 | 663 | template<class Sigs>
|
666 | 664 | concept @\exposconceptnc{valid-completion-signatures}@ = @\seebelownc@; // \expos
|
667 | 665 |
|
668 |
| - // \ref{exec.util.cmplsig.trans} |
669 |
| - template< |
670 |
| - @\exposconcept{valid-completion-signatures}@ InputSignatures, |
671 |
| - @\exposconcept{valid-completion-signatures}@ AdditionalSignatures = completion_signatures<>, |
672 |
| - template<class...> class SetValue = @\seebelow@, |
673 |
| - template<class> class SetError = @\seebelow@, |
674 |
| - @\exposconcept{valid-completion-signatures}@ SetStopped = completion_signatures<set_stopped_t()>> |
675 |
| - using transform_completion_signatures = completion_signatures<@\seebelow@>; |
| 666 | + struct dependent_sender_error : exception {}; |
676 | 667 |
|
677 |
| - template< |
678 |
| - @\libconcept{sender}@ Sndr, |
679 |
| - class Env = env<>, |
680 |
| - @\exposconcept{valid-completion-signatures}@ AdditionalSignatures = completion_signatures<>, |
681 |
| - template<class...> class SetValue = @\seebelow@, |
682 |
| - template<class> class SetError = @\seebelow@, |
683 |
| - @\exposconcept{valid-completion-signatures}@ SetStopped = completion_signatures<set_stopped_t()>> |
684 |
| - requires @\libconcept{sender_in}@<Sndr, Env> |
685 |
| - using transform_completion_signatures_of = |
686 |
| - transform_completion_signatures< |
687 |
| - completion_signatures_of_t<Sndr, Env>, |
688 |
| - AdditionalSignatures, SetValue, SetError, SetStopped>; |
| 668 | + // \ref{exec.getcomplsigs} |
| 669 | + template<class Sndr, class... Env> |
| 670 | + consteval auto get_completion_signatures() -> @\exposconcept{valid-completion-signatures}@ auto; |
| 671 | + |
| 672 | + template<class Sndr, class... Env> |
| 673 | + requires @\libconcept{sender_in}@<Sndr, Env...> |
| 674 | + using completion_signatures_of_t = decltype(get_completion_signatures<Sndr, Env...>()); |
689 | 675 |
|
690 | 676 | // \ref{exec.run.loop}, run_loop
|
691 | 677 | class run_loop;
|
|
733 | 719 | \end{itemize}
|
734 | 720 |
|
735 | 721 | \pnum
|
736 |
| -For types \tcode{Sndr} and \tcode{Env}, |
737 |
| -\tcode{\exposid{single-sender-value-type}<Sndr, Env>} is an alias for: |
| 722 | +For type \tcode{Sndr} and pack of types \tcode{Env}, |
| 723 | +let \tcode{CS} be \tcode{completion_signatures_of_t<Sndr, Env...>}. |
| 724 | +Then \tcode{\exposid{single-sender-value-type}<Sndr, Env>} is ill-formed |
| 725 | +if \tcode{CS} is ill-formed or |
| 726 | +if \tcode{sizeof...(Env) > 1} is \tcode{true}; |
| 727 | +otherwise, it is an alias for: |
738 | 728 | \begin{itemize}
|
739 | 729 | \item
|
740 |
| -\tcode{value_types_of_t<Sndr, Env, decay_t, type_identity_t>} |
| 730 | +\tcode{\exposid{gather-signatures}<set_value_t, CS, decay_t, type_identity_t>} |
741 | 731 | if that type is well-formed,
|
742 | 732 | \item
|
743 | 733 | Otherwise, \tcode{void}
|
744 |
| -if \tcode{value_types_of_t<Sndr, Env, tuple, variant>} is |
| 734 | +if \tcode{\exposid{gather-signatures}<set_value_t, CS, tuple, variant>} is |
745 | 735 | \tcode{variant<tuple<>>} or \tcode{vari\-ant<>},
|
746 | 736 | \item
|
747 |
| -Otherwise, \tcode{value_types_of_t<Sndr, Env, \exposid{decayed-tuple}, type_identity_t>} |
| 737 | +Otherwise, \tcode{\exposid{gather-signatures}<set_value_t, CS, \exposid{decayed-tuple}, type_identity_t>} |
748 | 738 | if that type is well-formed,
|
749 | 739 | \item
|
750 | 740 | Otherwise, \tcode{\exposid{single-sender-value-type}<Sndr, Env>} is ill-formed.
|
|
762 | 752 | }
|
763 | 753 | \end{codeblock}
|
764 | 754 |
|
| 755 | +\pnum |
| 756 | +A type satisfies and models the exposition-only concept |
| 757 | +\exposconcept{valid-completion-signatures} if |
| 758 | +it is a specialization of the \tcode{completion_signatures} class template. |
| 759 | + |
765 | 760 | \rSec1[exec.queries]{Queries}
|
766 | 761 |
|
767 | 762 | \rSec2[exec.fwd.env]{\tcode{forwarding_query}}
|
|
1251 | 1246 | a set of completion operations
|
1252 | 1247 | whose first argument is a subexpression equal to \tcode{rcvr}.
|
1253 | 1248 | Let \tcode{Sigs} be a pack of completion signatures corresponding to
|
1254 |
| -this set of completion operations. |
1255 |
| -Then the type of the expression \tcode{get_completion_signatures(sndr, env)} is |
| 1249 | +this set of completion operations, and |
| 1250 | +let \tcode{CS} be |
| 1251 | +the type of the expression \tcode{get_completion_signatures(Sndr, Env)()}. |
| 1252 | +Then \tcode{CS} is |
1256 | 1253 | a specialization of
|
1257 | 1254 | the class template \tcode{completion_signatures}\iref{exec.util.cmplsig},
|
1258 | 1255 | the set of whose template arguments is \tcode{Sigs}.
|
| 1256 | +If none of the types in \tcode{Sigs} are dependent on the type \tcode{Env}, then |
| 1257 | +the expression \tcode{get_completion_signatures<Sndr>()} is well-formed and |
| 1258 | +its type is \tcode{CS}. |
1259 | 1259 | If a user-provided implementation of the algorithm
|
1260 |
| -that produced \tcode{sndr} is selected instead of the default, |
1261 |
| -any completion signature |
| 1260 | +that produced \tcode{sndr} is selected instead of the default: |
| 1261 | + |
| 1262 | +\begin{itemize} |
| 1263 | +\item |
| 1264 | +Any completion signature |
1262 | 1265 | that is in the set of types
|
1263 | 1266 | denoted by \tcode{completion_signatures_of_t<Sndr, Env>} and
|
1264 | 1267 | that is not part of \tcode{Sigs} shall correspond to
|
1265 | 1268 | error or stopped completion operations,
|
1266 | 1269 | unless otherwise specified.
|
1267 | 1270 |
|
| 1271 | +\item |
| 1272 | +If none of the types in \tcode{Sigs} are dependent on the type \tcode{Env}, then |
| 1273 | +\tcode{completion_signatures_of_t<Sndr>} and |
| 1274 | +\tcode{completion_signatures_of_t<Sndr, Env>} |
| 1275 | +shall denote the same type. |
| 1276 | +\end{itemize} |
| 1277 | + |
1268 | 1278 | \rSec2[exec.snd.expos]{Exposition-only entities}
|
1269 | 1279 |
|
1270 | 1280 | \pnum
|
|
1279 | 1289 | the expression \tcode{\exposid{FWD-ENV}(env).query(q, as...)} is ill-formed
|
1280 | 1290 | if \tcode{forwarding_query(q)} is \tcode{false};
|
1281 | 1291 | otherwise, it is expression-equivalent to \tcode{env.query(q, as...)}.
|
| 1292 | +%%FIXME: Where did FWD-ENV-T come from? |
| 1293 | +The type \tcode{\exposid{FWD-ENV-T}(Env)} is |
| 1294 | +\tcode{decltype(\exposid{FWD-ENV}(declval<Env>()))}. |
1282 | 1295 |
|
1283 | 1296 | \pnum
|
1284 | 1297 | For a query object \tcode{q} and \tcode{a} subexpression \tcode{v},
|
|
1568 | 1581 | otherwise, \tcode{false}.
|
1569 | 1582 | \end{itemdescr}
|
1570 | 1583 |
|
| 1584 | +\pnum |
| 1585 | +Let \exposconcept{valid-specialization} be the following concept: |
| 1586 | +\begin{codeblock} |
| 1587 | +namespace std::execution { |
| 1588 | + template<template<class...> class T, class... Args> |
| 1589 | + concept @\defexposconceptnc{valid-specialization}@ = // \expos |
| 1590 | + requires { typename T<Args...>; }; |
| 1591 | +} |
| 1592 | +\end{codeblock} |
| 1593 | + |
1571 | 1594 | \begin{itemdecl}
|
1572 | 1595 | template<class Tag, class Data = @\seebelow@, class... Child>
|
1573 | 1596 | constexpr auto @\exposid{make-sender}@(Tag tag, Data&& data, Child&&... child);
|
|
1581 | 1604 | \item \tcode{\libconcept{semiregular}<Tag>}
|
1582 | 1605 | \item \tcode{\exposconcept{movable-value}<Data>}
|
1583 | 1606 | \item \tcode{(\libconcept{sender}<Child> \&\& ...)}
|
| 1607 | +\item% |
| 1608 | +\tcode{\libconcept{dependent_sender}<Sndr> || \libconcept{sender_in}<Sndr>}, |
| 1609 | +where \tcode{Sndr} is \tcode{\exposid{basic-sender}<Tag, Data, Child...>} |
| 1610 | +as defined below. |
| 1611 | + |
| 1612 | +%%FIXME: OK to have \recommended inside an itemized list like this? |
| 1613 | +\pnum |
| 1614 | +\recommended |
| 1615 | +If evaluation of \tcode{\libconcept{sender_in}<Sndr>} results in |
| 1616 | +an uncaught exception from |
| 1617 | +the evaluation of \tcode{get_completion_signatures<Sndr>()}, |
| 1618 | +the implementation should include information about that exception in |
| 1619 | +the resulting diagnostic. |
1584 | 1620 | \end{itemize}
|
1585 | 1621 |
|
1586 | 1622 | \pnum
|
|
1597 | 1633 | concept @\defexposconceptnc{completion-tag}@ = // \expos
|
1598 | 1634 | @\libconcept{same_as}@<Tag, set_value_t> || @\libconcept{same_as}@<Tag, set_error_t> || @\libconcept{same_as}@<Tag, set_stopped_t>;
|
1599 | 1635 |
|
1600 |
| - template<template<class...> class T, class... Args> |
1601 |
| - concept @\defexposconceptnc{valid-specialization}@ = // \expos |
1602 |
| - requires { typename T<Args...>; }; |
1603 |
| - |
1604 | 1636 | struct @\exposidnc{default-impls}@ { // \expos
|
1605 | 1637 | static constexpr auto @\exposidnc{get-attrs}@ = @\seebelownc@; // \expos
|
1606 | 1638 | static constexpr auto @\exposidnc{get-env}@ = @\seebelownc@; // \expos
|
1607 | 1639 | static constexpr auto @\exposidnc{get-state}@ = @\seebelownc@; // \expos
|
1608 | 1640 | static constexpr auto @\exposidnc{start}@ = @\seebelownc@; // \expos
|
1609 | 1641 | static constexpr auto @\exposidnc{complete}@ = @\seebelownc@; // \expos
|
| 1642 | + |
| 1643 | + template<class Sndr, class... Env> |
| 1644 | + static consteval void @\exposidnc{check-types}@(); // \expos |
1610 | 1645 | };
|
1611 | 1646 |
|
1612 | 1647 | template<class Tag>
|
|
1621 | 1656 | decltype(@\exposid{impls-for}@<tag_of_t<Sndr>>::@\exposid{get-env}@), Index,
|
1622 | 1657 | @\exposid{state-type}@<Sndr, Rcvr>&, const Rcvr&>;
|
1623 | 1658 |
|
| 1659 | + template<class Sndr> |
| 1660 | + using @\exposidnc{data-type}@ = decltype(declval<Sndr>().template @\exposidnc{get}@<1>()); // \expos |
| 1661 | + |
1624 | 1662 | template<class Sndr, size_t I = 0>
|
1625 | 1663 | using @\exposidnc{child-type}@ = decltype(declval<Sndr>().template @\exposidnc{get}@<I+2>()); // \expos
|
1626 | 1664 |
|
|
1696 | 1734 | }
|
1697 | 1735 | };
|
1698 | 1736 |
|
1699 |
| - template<class Sndr, class Env> |
1700 |
| - using @\exposidnc{completion-signatures-for}@ = @\seebelownc@; // \expos |
1701 |
| - |
1702 | 1737 | template<class Tag, class Data, class... Child>
|
1703 | 1738 | struct @\exposidnc{basic-sender}@ : @\exposidnc{product-type}@<Tag, Data, Child...> { // \expos
|
1704 | 1739 | using sender_concept = sender_t;
|
|
1716 | 1751 | }
|
1717 | 1752 |
|
1718 | 1753 | template<@\exposconcept{decays-to}@<@\exposid{basic-sender}@> Self, class Env>
|
1719 |
| - auto get_completion_signatures(this Self&& self, Env&& env) noexcept |
1720 |
| - -> @\exposid{completion-signatures-for}@<Self, Env> { |
1721 |
| - return {}; |
1722 |
| - } |
| 1754 | + static constexpr auto get_completion_signatures(); |
1723 | 1755 | };
|
1724 | 1756 | }
|
1725 | 1757 | \end{codeblock}
|
|
0 commit comments