Brace Initialization syntax

Did you know that C++11 (which is now the official ISO standard for C++ compilers) provides a new way of initializing objects using braces? Even if you know that you can use it to construct STL containers from ranges of values, you might not have been told that you can use the new syntax to make function calls and return statements look shorter by not specifying the type which the compiler can deduce (similar to the new 'auto' syntax).

Have a look at some examples I have compiled.

Indeed, I initially underestimated the usefulness of uniform initialization, but it turned out to be one of the most time-saving C++11 features.
Nice article, by the way.
Topic archived. No new replies allowed.