Can I create an anonymous, brace-initialized aggregate in C++? -
One can create an anonymous object that is initialized through constructor parameters, such as in the return statement below.
struct S {S (int i_, int j_): i (i_), j (j_) {} int i, j; }; SF () {Return S (52, 100); } Int main () {cout & lt; & Lt; F (). I & lt; & Lt; Endl; Return 0; }
However, can it equally create an anonymous total , which is initially initialized initially? For example, without any one without a return statement, the body of F () can fall down?
struct {int i, j; }; Sf () {ss = {52, 100}; Return S; } Int main () {cout & lt; & Lt; F (). I & lt; & Lt; Endl; Return 0; }
You can not use C ++ in the current version of C ++ I will be able to - I believe in anyway. Of course, it is still open for modification - at one time I believed that you would be able to specify the concepts in C ++ 0x, but it is finished ...
Edit : The reference to [dcl.init] (§8.5 / 1) is the definition of the most relevant bit BNF (and the last bit of the text, 'braces-init-list'), which is saying that the initialization described in that section Prices can return.)
Comments
Post a Comment