I would like to initialize std::vector
with a range of consecutive integers without typing all of them, something like a second line, which doesn't compile, in this code snippet:
std::vector<int> a{0, 1, 2, 3, 4, 5};
std::vector<int> b{std::ranges::iota_view(0, 5)}; // ERROR!
Of course, I would greatly prefer:
std::vector<int> b{0:5};
but this is not scheduled before C++41 standard. Any ideas how to do it in C++20?