What does it mean to have std :: array, an array of zero size?
Same as, for example, empty std::vector or empty std::set .
Why is it not defined as illegal?
it is advisable to make this legal, because it means that universal programming should not handle the special case where the size of std::array is the result of calculating compilation time.
it is possible to define it as legal due to the specialization of templates. For example, the implementation that ships with Visual C ++ specializes in std::array in a way similar to the following:
template<class T> class array<T, 0> // specialisation {
I believe that every compiler implements std::array like this.
Christian hackl
source share