【发布时间】:2019-04-13 14:51:30
【问题描述】:
代码部分有效。但如果我改用注释掉的版本,
using StorageType = alignas(alignof(T)) char[sizeof(T)];
我收到错误。
template <typename T> struct minipool {
union minipool_item {
private:
//using StorageType = alignas(alignof(T)) char[sizeof(T)];
using StorageType = char[sizeof(T)];
// Points to the next freely available item.
minipool_item *next;
// Storage of the item. Note that this is a union
// so it is shared with the pointer "next" above.
StorageType datum;
....
};
};
正确的语法是什么?
【问题讨论】: