In libc++, the specialization of std::array<T,0>
has a member (const
) char
array, which is aligned and sized according to T
(source). I wonder what is the reason for this implementation since this member (__elems_
) does not seem to be used anywhere. For comparison, libstdc++ uses an empty member, and Microsoft STL uses an empty member if T
is not default-constructible (otherwise, it creates a single-element array).
Live demo of the difference: https://godbolt.org/z/1o167na6z