Conversation
There was a problem hiding this comment.
Pull request overview
This PR makes the .end() method const and constexpr for both Generator and AsyncGenerator classes, addressing issue #294. The change allows .end() to be called on const instances and enables compile-time evaluation where possible.
- Made
.end()methodsconstexprandconst noexceptin both generator types - Updated iterator constructors to support
constexprinitialization - Changed
AsyncGenerator::end()return type fromautoto explicititeratortype
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| qcoro/qcorogenerator.h | Made GeneratorIterator(std::nullptr_t) constructor constexpr noexcept and updated Generator::end() to be constexpr const noexcept |
| qcoro/qcoroasyncgenerator.h | Made IteratorAwaitableBase(std::nullptr_t) constructor constexpr, changed AsyncGenerator::end() return type to explicit iterator, and made it constexpr const noexcept |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| /// Returns an iterator representing the finished generator. | ||
| auto end() noexcept { | ||
| constexpr iterator end() const noexcept { |
There was a problem hiding this comment.
The end() method is marked as constexpr, but the AsyncGeneratorIterator(std::nullptr_t) constructor it calls (line 207) is not marked as constexpr. For the end() method to be properly constexpr, the constructor it invokes must also be constexpr. Consider adding constexpr to the AsyncGeneratorIterator(std::nullptr_t) constructor for consistency with the changes made to GeneratorIterator in the other file.
054f02f to
9b49a46
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fixes #294.