我有下一个类,希望用0初始化_operators数组:
//Entity.h
class Entity
{
static const unsigned short operatorTypeColumn = 1;
static const unsigned short outputValueColumn = 4;
private:
mainDataType _operators[operatorsMaxCount][operatorsTableWidth];
}
//Entity.cpp. I thought this should work in C++ v11
Entity::Entity(void) : _operators[operatorsMaxCount][operatorsTableWidth]
{
}我以为这个卖了C++ v11的作品,但我错了.如何用0初始化数组。丑陋的?我不想让它静止不动
发布于 2013-09-08 09:02:14
只需对数组进行值初始化:
Entity::Entity() : _operators() {}
// ^^这在C++03和C++11中是可行的。
https://stackoverflow.com/questions/18682034
复制相似问题