Just switched to C++11 from C++03, and I was wondering, is the following defined to always zero initialize the array data
for all elements?
template<size_t COUNT>
class Test {
public:
uint32 data[COUNT] = {};
};
Just switched to C++11 from C++03, and I was wondering, is the following defined to always zero initialize the array data
for all elements?
template<size_t COUNT>
class Test {
public:
uint32 data[COUNT] = {};
};
Yes it's guaranteed; list initialization turns to aggregate initialization for array type:
then for aggregate initialization:
So all the elements of
data
will be value initialized, foruint32
they'll be zero-initialized at last.