Why is this an illegal declaration?
> std::views::iota r(0, 10);
error: expected ‘;’ before ‘r’
but this works
> auto r = std::views::iota(0, 10);
views::iota
is a customization point object, which is a function object that overloads an operator()
that returns a ranges::iota_view
object.
ranges::iota_view
is the implementation details of views::iota
, which is a class type. So you probably mean
std::ranges::iota_view r(0, 10);
However, you should always prefer using views::meow
over ranges::meow_view
.