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.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get exception ptr CPO #249
base: main
Are you sure you want to change the base?
Get exception ptr CPO #249
Changes from 9 commits
f8d2291
cfb4ff0
812e58a
bb8f46b
ec30d89
2461d80
e4cc6f6
aca13cb
532a343
ecad7f0
d326b09
9b57372
8d75bad
a19d14a
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer if this were an overload in
_fn
rather than atag_invoke
overload at namespace scope.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way you have constrained this requirement means that it will always convert the error to an exception_ptr if it can and the set_error() method can be invoked with an exception_ptr.
I think that what we want instead is to try to invoke set_error() with the provided type and only if there is no tag_invoke() or member function set_error() overload that accepts that type then, if the error type can be converted to exception_ptr and you can invoke set_error (either by tag_invoke or member function) with an exception_ptr then do that as a fallback.
So the order of resolution would be:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I missed it.
I added a test case to validate this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to update the
_result_t
alias to account for this overload. Look how it is done elsewhere withif constexpr
in other customization points.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a
_select
function (reproduced fromconnect
CPO), I hope it is fine.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually the nothrow type-trait queries haven't been represented as concepts but rather as boolean type-traits.
I'm not sure exactly why that is, though. Maybe @ericniebler has some thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Precedence for one. The fact that it's all syntax and no semantics for another. Neither of which are particularly compelling reasons.