【发布时间】:2020-02-12 05:31:02
【问题描述】:
我发现std::array<T, 0> 的 std::array 中有一个模板部分特化。
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)];
//...
}
那么实现std::array<T, 0>的目的是什么?
非常感谢!
【问题讨论】:
-
重新打开。链接的副本是关于
std::is_empty<std::array<T, 0>>含义的狭义问题。