Hi Group!
Ping?
Why can the outer braces in an std::array brace initializer
be elided when the element initializers are variables, but
not when they are themselves brace initializers?
I tried the code below with another online compiler:
https://www.jdoodle.com/online-compiler-c++14
that explicitly claims c++14 support, and I get the same
result as reported before.
Full details below, but in short:
std::array<std::vector<unsigned>, 2> avux {{ vu0, vu1 }};
-- compiles
std::array<std::vector<unsigned>, 2> avux { vu0, vu1 };
-- compiles with outer braces elided
but
std::array<std::vector<unsigned>, 2> avuy {{ { 1, 2, 3 }, { 4, 5 } }};
-- compiles
std::array<std::vector<unsigned>, 2> avuz { { 1, 2, 3 }, { 4, 5 } };
-- does not compile with outer braces elided
Explained by the language? Bug in g++?
Thanks.
K. Frank