-
Notifications
You must be signed in to change notification settings - Fork 1.6k
<generator>: Mark strengthened noexcept (plus tiny drive-by changes)
#4351
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
Merged
Stephan T. Lavavej (StephanTLavavej)
merged 2 commits into
microsoft:feature/generator
from
cpplearner:patch-1
Jan 31, 2024
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -210,7 +210,7 @@ public: | |
| } | ||
|
|
||
| _NODISCARD auto yield_value(const remove_reference_t<_Yielded>& _Val) noexcept( | ||
| is_nothrow_constructible_v<remove_cvref_t<_Yielded>, const remove_reference_t<_Yielded>&>) | ||
| is_nothrow_constructible_v<remove_cvref_t<_Yielded>, const remove_reference_t<_Yielded>&>) /* strengthened */ | ||
| requires (is_rvalue_reference_v<_Yielded> | ||
| && constructible_from<remove_cvref_t<_Yielded>, const remove_reference_t<_Yielded>&>) | ||
| { | ||
|
|
@@ -225,7 +225,7 @@ public: | |
|
|
||
| template <_RANGES input_range _Rng, class _Alloc> | ||
| requires convertible_to<_RANGES range_reference_t<_Rng>, _Yielded> | ||
| _NODISCARD auto yield_value(_RANGES elements_of<_Rng, _Alloc> _Elem) noexcept { | ||
| _NODISCARD auto yield_value(_RANGES elements_of<_Rng, _Alloc> _Elem) { | ||
| using _Vty = _RANGES range_value_t<_Rng>; | ||
| return _Nested_awaitable<_Yielded, _Vty, _Alloc>{ | ||
| [](allocator_arg_t, _Alloc, _RANGES iterator_t<_Rng> _It, | ||
|
|
@@ -238,7 +238,7 @@ public: | |
|
|
||
| void await_transform() = delete; | ||
|
|
||
| void return_void() noexcept {} | ||
| void return_void() const noexcept {} | ||
|
|
||
| void unhandled_exception() { | ||
| if (_Info) { | ||
|
|
@@ -362,7 +362,7 @@ public: | |
| return *this; | ||
| } | ||
|
|
||
| _NODISCARD _Ref operator*() const noexcept { | ||
| _NODISCARD _Ref operator*() const noexcept(noexcept(static_cast<_Ref>(*_Coro.promise()._Top.promise()._Ptr))) { | ||
| _STL_ASSERT(!_Coro.done(), "Can't dereference generator end iterator"); | ||
| return static_cast<_Ref>(*_Coro.promise()._Top.promise()._Ptr); | ||
| } | ||
|
|
@@ -377,8 +377,9 @@ public: | |
| ++*this; | ||
| } | ||
|
|
||
| _NODISCARD bool operator==(default_sentinel_t) const noexcept { | ||
| return _Coro.done(); | ||
| _NODISCARD_FRIEND bool operator==(const _Gen_iter& _It, default_sentinel_t) noexcept /* strengthened */ | ||
| { | ||
|
Comment on lines
+380
to
+381
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another stylistic nitpick: There's enough room for the brace here to be attached; clang-format exhibits "sticky" behavior and will preserve it. Also not worth resetting testing for this PR. |
||
| return _It._Coro.done(); | ||
| } | ||
|
|
||
| private: | ||
|
|
||
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.
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.
Stylistic nitpick: We use
/* strengthened */when it's embedded in a line (especially before an opening brace), but the followingrequireswill always be clang-formatted on a new line, so this should ideally be a C++ comment// strengthened. Not worth resetting testing though.