Editorial: coroutine_handle::from_address - consolidate duplicate definitions, add missing constexpr and replace address() with address in precondition wording #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains editorial fixes relating to
coroutine_handle'sfrom_addressmethod ([coroutine.handle.import.export]). It is related to #5.Consolidate duplicate definitions of
There are currently two definitions of the
from_address: one in [coroutine.handle.import.export] and one in [coroutine.handle.import]. In the class synopses in [coroutine.handle], thecoroutine_handle<>specialization references [coroutine.handle.import.export] while primary definition forcoroutine_handlereferences [corouinte.handle.import].They are nearly identical in wording. although the definition in [coroutine.handle.import.export] is written as if it was out of line (e.g.
coroutine_handle<>::from_address).Even though the primary template of
coroutine_handleinherits fromcoroutine_handle<>it is necessary to definefrom_addressin the primary template, but I did not realize this at first.from_addressreturnscoroutine_handle, which is a different type in the primary template than it is incoroutine_handle(we usecoroutine_handlewithin the class definition so this may not be clear at first to consumers of the spec):Otherwise, the two definitions are identical.
I think the best thing to do is to keep the declarations in both classes in the class synopsis and have one definition of
from_address, but list both signatures as if they were out of line, e.g.:Replace
address()withaddressin precondition wordingfrom_address's Requires: paragraph in [coroutine.handle.import.export] states the pre-condition that "addrwas obtained via a prior call toaddress()". It should beaddress, notaddress(), sinceaddress()is an expression not a method (e.g. read very pedantically, this says "obtained via a prior call to somevoid*" which doesn't make sense).Add missing constexpr
from_addressis declaredconstexprin the class synopsis ([coroutine.handle], in both the primary template and the specialization forcoroutine_handle<>) but is notconstexprin the definition. The design intent, I believe, is forfrom_addressto be constexpr.This pull request:
from_addressdefinition containingcoroutine_handle<>:from_addressin [coroutine.handle.import.export].from_addressdefinition from [coroutine.handle.import] to [coroutine.handle.import.export].coroutine_handle<>andcoroutine_handle<Promise>signature in the new unified definition offrom_address.address()withaddressinfrom_address's precondition wording [coroutine.handle.import.export] p2.from_addresssignature in [coroutine.handle.import.export]constexpr.