C++11: initializer lists

image0

Prior C++11, curly braces could be used to initialize POD-compliant structures or classes only. In C++11, the use of curly braces has been extended. This improvement has been done partly for the new std::initializer_list object, that is useful when constructing sequence objects, for example a std::vector ...

more ...




User-defined literals

image1

source image

I deem this definition of a literal relevant:

Literal constants are invariants whose values are implied by their representations.

Literals are useful:

float million = 1e6;

C++11 now offers user-defined literals, which will be very handy, and not only as syntactic sugar. Consider the simple example of manipulating ...

more ...

C++11: Variadic templates

image1

Image originale ici

L'introduction de C++11 apporte dans son jeu de nouvelles fonctionnalités les variadic templates, qui permettent de spécifier des paramètres de patrons à géométrie variable. Voici un exemple qui illustre l'avantage des variadic templates comparé aux méthodes "classiques", pour pallier à un problème courant : utiliser ...

more ...