-
Notifications
You must be signed in to change notification settings - Fork 1.6k
<generator>: Make nested types of generator ADL-proof
#4464
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
<generator>: Make nested types of generator ADL-proof
#4464
Conversation
which is consistent with the handling of `polymorphic_allocator`.
| _NODISCARD auto yield_value(_RANGES elements_of<generator<_Rty, _Vty, _Alloc>&&, _Unused> _Elem) noexcept { | ||
| return _Nested_awaitable<_Rty, _Vty, _Alloc>{std::move(_Elem.range)}; | ||
| using _Nested_awaitable = _Nested_awaitable_provider<_Rty, _Vty, _Alloc>::_Awaitable; | ||
| return _Nested_awaitable{std::move(_Elem.range)}; |
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.
We should use _STD in product code.
| using validator = holder<incomplete>*; | ||
| auto yield_range = []() -> std::generator<validator> { | ||
| co_yield ranges::elements_of( | ||
| ranges::views::repeat(nullptr, 42) | ranges::views::transform([](std::nullptr_t) { return validator{}; })); |
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.
Should include <cstddef> for std::nullptr_t.
|
Thanks! I'll go ahead and merge this, and then I'll prepare a followup PR to fix the nitpicks I noticed plus a couple other pre-existing issues. |
|
I previously wrote
But this paragraph is wrong -
|
Towards #2936.
Per the synopsis in [coro.generator.class], the
iteratorandpromise_typetypes are non-template classes, so they should be ADL-proof even if the enclosinggeneratorspecialization is ADL-incompatible._Nested_awaitableis also changed to a nested non-template class to makegenerator<holder<incomplete>*>yieldable._Promise_allocatoris currently unchangedbecause Cpp17Allocator essentially requires allocator types to be ADL-compatible.Perhaps we should change it to a member marked withThis is wrong.[[msvc::no_unique_address]]later.Drive-by change: make the default template arguments of
elements_ofand its deduction guide conditionally present, which is consistent withpolymorphic_allocator.STL/stl/inc/xpolymorphic_allocator.h
Lines 196 to 201 in d6efe94