Change std::ranges::elements_of() to be a function instead of a type used with CTAD
lewissbaker opened this issue · 2 comments
The current implementation defines std::ranges::elements_of<Range>
using CTAD to allow use like a function inside co_yield std::ranges::elements_of(someRange)
expressions.
This choice, however, makes it difficult to later add overloads of std::ranges::elements_of()
that might take additional arguments.
e.g. an allocator if we wanted to allow overriding the allocator to be used for the implicit coroutine in some co_yield std::ranges::elements_of(range, alloc);
expressions.
We should change elements_of()
to be a function that returns the type elements_of_t<Range>
instead of being a type to be used with CTAD to keep open this evolutionary pathway for the API.
I don't necessarily think we should do that without running it through LEWG, especially as we have the allocator now.
Well, tbh, I struggle being sympathetic with abi-motivated designs even if i know it will come back to haunt us.
So, maybe you are right?
Closing as wont-fix for now as CTAD is now viable with the extra template parameter added to elements_of.