cppfront
cppfront copied to clipboard
[SUGGESTION] Make main args usable with ranges
While toying with hello world, noticed that cpp2:args
isn't usable with std::ranges
.
Suggesting to update definition to satisfy std::ranges::bidirectional_range
, so that the following is possible:
main: (args) = {
static_assert(std::bidirectional_iterator<cpp2::args::iterator>);
static_assert(std::ranges::bidirectional_range<cpp2::args>);
static_assert(std::ranges::viewable_range<cpp2::args>);
// Output command line arguments, dropping the program name argc[0].
for args | std::ranges::views::drop(1) do (arg)
{
std::cout
<< arg << std::endl;
}
}
PR inbound...