I want to initialize an array with a sequence of int
s from 0
to N - 1
#include
#include
I'm not sure if this meets your requirements.
#include <array>
#include <iostream>
template <size_t ...I>
constexpr auto init(std::index_sequence<I...>) {
return std::array<size_t, sizeof...(I)>{I...};
}
int main(void)
{
std::array<size_t, 10> a = init(std::make_index_sequence<10>());
for (int const & i : a)
std::cout << i << "\n";
return 0;
}