As you say below, data layout is a much more common issue than a
performance hit being significant due to a few padding bytes. /If/
performance is suspect to be an actual problem, then demonstration
first, sure.
>
> Compatibility when different modules want differently laid out data and
> algorithmic simplicity and robustness are common problems in all software.
> Can raw array somehow be used to solve those common and real problems?
> I would love to see that demonstrated too as I do not even imagine it being
> possible.
One might think of some multidimensional (e.g. image) processing (or
compression) algorithm that assumes no padding. Then it is cleaner and
easier to use a raw array than an array of arrays, rather than rewriting
a possibly complex algorithm to handle some arbitrary padding between lines.
I mean, the sport of using std::array<std::array<...>, ...> wouldn't
justify such a rewrite per se.
Although, for this specific example, with a multidim raw array the UB
fluff of the C++ standard might get in the way, so the case is not
trivial either.
A probably more realistic example is some API between modules, possibly
even written in different languages, that exchange binary data whose
layout is part the contract. Then you want full control of such layout,
including padding.
In such scenario I believe you don't want a std::array as a member of
some struct that is passed through such interface. This is independent
of performance, of course.