ARTICLE AD BOX
You likely want a std::integer_sequence, such as:
std::integer_sequence<unsigned, 2, 4, 6, 8, 10>In this example, you might also compose the generator std::ranges::iota_view with a std::ranges::transform_view that multiplies each element by 2.
In many cases, though, a good alternative is to create a static constexpr array, such as
static constexpr int evens_raw[] = {2, 4, 6, 8, 10};Or the equivalent std::array. The address, size and contents of this array are all constant expressions, and so are the std::begin and std::end iterators. Modern compilers can therefore often optimize away actually creating the array in memory.
