For example, if I wanted a constexpr std::array<int,100>
initialised with all the multiples of 3 from 1-300 at compile time how can I do this?
My first thought was to use std::generate, something like:
constexpr std::array<int,100> a { std::generate(a.begin(), a.end(), [n=0]()mutable{ return n+=3; });
I get an error such as <source>:9:52: error: void value not ignored as it ought to be
and I can't use std::generate after this because of course, it's read only at that point
Thanks for any help