Recently, I gave a talk titled “Initialisation in modern C++”, which was apparently quite well received. (A video recording is available here).
One of the slides in this talk was a matrix tabulating all the possible initialisation syntaxes and what they do for different kinds of types (such as: built-in types, aggregates, etc.)
Ever since then, I keep getting requests for a high-resolution version of that table. So finally I got around to uploading one. Here it is:
You can freely reuse this table – I hope it will be useful. And please let me know if you spot any mistakes 🙂
Keep in mind that the above table is for C++17, but things will change in C++20, in particular for aggregate types: we will get designated initialisers as well as direct initialisation for aggregates.