mardi 11 février 2020

What is the purpose of std :: array

I found that there is a template partial specialisation in std::array for std::array<T, 0>.

template <typename T>
struct array<T, 0> {
    //...
    typedef typename conditional<is_const<_Tp>::value, const char,
                                char>::type _CharType;
    struct  _ArrayInStructT { _Tp __data_[1]; };
    alignas(_ArrayInStructT) _CharType __elems_[sizeof(_ArrayInStructT)];
    //...
}

So what is the purpose of implementing std::array<T, 0>?

Thanks very much!

Aucun commentaire:

Enregistrer un commentaire