Closed
Description
I've made a simple Godbolt for a demonstration of the approach.
In short, with array::map stabilized in 1.55 it's now possible to make an array [T; N]
of default values of T
by invoking [(); N].map(|_| T::default())
. There is no difference in the emitted assembly for either O2 or O3 optimization levels in my short example for usize
and user defined type (both ZST and not ZST), but obviously there is no guarantee that some more complex cases would not diverge.
I would expect that lifting a hard limitation of 32 on the size of the array would be handy in general.