Do you know how to use initializer lists?
Bitesize Modern C++: std::initializer_list
by Glennan Carnie
From the article:
An aggregate type in C++ is a type that can be initialised with a brace-enclosed list of initialisers. C++ contains three basic aggregate types, inherited from C:
- arrays
- structures
- unions
Since one of the design goals of C++ was to emulate the behaviour of built-in types it seems reasonable that you should be able to initialise user-defined aggregate types (containers, etc.) in the same way...
Add a Comment
Comments are closed.