This paper proposes merging Working Draft of Coroutines TS [N4736] into the C++20 working draft [N4741].
r0: initial revision
Coroutines address the dire need by dramatically simplifying development of asynchronous code. Coroutines have been available and in use for 4 years. We have implementations from two major compiler vendors. It is time to merge Coroutines TS to the working paper.
Apply coroutine wording from N4736 to the working draft with the following changes:
Apply changes from "LWG requested edits on 2018-June-08" section below.
Apply resolution of issue 29 from Coroutine TS issue list P0664R4.
Add underlined text to rationale in [diff.cpp17.lex]:
Rationale: Required for new features. The
requireskeyword is added to introduce constraints through a requires-clause or a requires-expression. The
conceptkeyword is added to enable the definition of concepts (17.6.8). Effect on original feature: Valid ISO C++ 2017 code using
requiresas an identifier is not valid in this International Standard.
Effect on original feature: The following C++ headers are new:
<syncstream>. Valid C++ 2017 code that #includes headers with these names may be invalid in this International Standard.
<experimental/coroutine>defines the primary template coroutine_traits such that if
ArgTypesis a parameter pack of types and
Ris a type that has a valid (17.8.2) member type
coroutine_traits<R,ArgTypes...>has the following publicly accessible member:
Allspecializations of this template shall define a publicly accessible nested type named
In clause 21.11 in titles of the subclauses replace "Struct template" with "Class template"
In clause 21.11 template introducers replace "typename" with "class"
Modify the paragraph 3 in subclause 188.8.131.52/[coroutine.handle.observers] as follows:
address() != nullptr
, otherwise false.
Synchronization: aconcurrent resumption of the coroutine via resume, operator(), or destroy may result in a data race.
Reorder relational operators in synopsis 21.11/[support.coroutine] and in subclause 184.108.40.206/[coroutine.handle.compare] to be in the following order:
==, !=, <, >, <=, >=.
Modify 220.127.116.11/[coroutine.handle.noop.address] as follows:
Remarks: A noop_coroutine_handle’s ptr always
containsa non-null pointer value.