Skip to content

coro::generator is not compatible with std::ranges::elements_of #431

@Tearnote

Description

@Tearnote

C++23 introduced std::ranges::elements_of, which allows for generating elements of generators with less overhead. A good example is on the std::generator cppreference page: https://en.cppreference.com/w/cpp/coroutine/generator.html

When available, it works with std::generator, but not coro::generator. I don't fully understand what is required for compatibility, but it seems to be a specific overload of yield_value(). elements_of itself is just five lines: https://github.com/anonymouspc/llvm/blob/main/libcxx/include/__ranges/elements_of.h#L32

Is this something that libcoro can implement?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions