C
Chris Forone
is it guaranteed, that std::array<std::array<float, 4>, 4> var = {};
sets all 16 values to 0.0f?
thanks, chris
sets all 16 values to 0.0f?
thanks, chris
is it guaranteed, that std::array<std::array<float, 4>, 4> var = {};
sets all 16 values to 0.0f?
i use visual studio express 2012 and it does right but i want maximumIt is required by C++11 standard. That (like any documentation) does not
always guarantee that software (compiler) is not defective. Do you have
compiler that does not?
Am 26.03.2013 15:01, schrieb Öö Tiib:
i use visual studio express 2012 and it does right but i want maximum
portability.
Chris said:is it guaranteed, that std::array<std::array<float, 4>, 4> var = {};
sets all 16 values to 0.0f?
Öö Tiib said:That (like any documentation) does not
always guarantee that software (compiler) is not defective.
If the compiler is defective then that's a compiler issue, not a language
issue. File a bug report with the compiler vendor.
Öö Tiib said:If you can not read then perhaps stop trying to. OP asked for "maximum
portability" not for "if it is kosher by language rules".
thanks.As far as I can tell, it is guaranteed. The C++11 standard (well, N3242)
defines a std::array as an aggregate that can be initialized with an
initializer list. Then, in 8.5.4 3 of that standard it is said that an
aggregate initialization with an empty initialization list ends up setting
all members to zero. Then, as your example consists of an aggregate which
contains sub-aggregates, 8.5.1 8 essentially states that the initializer
clause for each sub-member can be omitted if you an empty initializer list
is used.
Rui Maciel
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.