Skip to content

Commit

Permalink
LWG-3899 co_yielding elements of an lvalue generator is unnecessarily…
Browse files Browse the repository at this point in the history
… inefficient (microsoft#5303)
  • Loading branch information
HNeitzel authored Feb 20, 2025
1 parent a4e32ac commit dfbe5ea
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions stl/inc/generator
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,13 @@ namespace _Gen_detail {
return _Nested_awaitable{_STD move(_Elem.range)};
}

template <class _Rty, class _Vty, class _Alloc, class _Unused>
requires same_as<_Yield_t<_Reference_t<_Rty, _Vty>>, _Yielded>
_NODISCARD auto yield_value(_RANGES elements_of<generator<_Rty, _Vty, _Alloc>&, _Unused> _Elem) noexcept {
using _Nested_awaitable = _Nested_awaitable_provider<_Rty, _Vty, _Alloc>::_Awaitable;
return _Nested_awaitable{_STD move(_Elem.range)};
}

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) {
Expand Down

0 comments on commit dfbe5ea

Please sign in to comment.