C++11 Structure Initialization

As with arrays, C++11 extends the features of list-initialization. The = sign is optional:

inflatable duck {"Daphne", 0.12, 9.98};  // can omit the = in C++11

Next, empty braces result in the individual members being set to 0. For example, the following declaration results in mayor.volume and mayor.price being set to 0 and all the bytes in mayor.name being set to 0:

inflatable mayor {};

Finally, narrowing is not allowed.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.40.189