#include <iostream>
#include <ranges>
int main()
{
for (int num: std::ranges::views::iota(0,5)) {
std::cout << num << 'n';
}
for (int i : std::ranges::iota_view{55, 65}) {
std::cout << i << '\n';
}
}
views::iota(e)
andviews::iota(e, f)
are expression-equivalent toiota_view(e)
andiota_view(e, f)
respectively for any suitable subexpressionse
andf
.
Is there any reason to use one vs the other?
And if not, why do they both exist since they were both introduced in C++20?