I'm reading through the draft standard for C++14 right now, and perhaps my legalese is a bit rusty, but I can't find any mention of allowing initializations like the following
std::array<int, 3> arr{1,2,3};
being legal. (EDIT: Apparently the above is legal syntax in C++11.) Currently in C++11 we have to initialize std::array as
std::array<int, 3> arr{{1,2,3}}; // uniform initialization + aggregate initialization
or
std::array<int, 3> arr = {1,2,3};
I thought I heard somewhere that they were relaxing the rules in C++14 so that we didn't have to use the double-brace method when using uniform initialization, but I can't find the actual proof.
NOTE: The reason I care about this is because I am currently developing a multi_array - type and don't want to have to initialize it like
multi_array<int, 2, 2> matrix = {
{{ 1, 2 }}, {{ 3, 4 }}
};
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…