Designated Initializers in C++20
The C++20 standard also gives us another handy way to initialize data members. The new feature is called designated initializers, and it might be familiar to C programmers.
We'll cover the following...
We'll cover the following...
The basics
In basic C++20 form, you can write:
Type obj = { .designator = val, .designator { val2 }, ... };
For example:
struct Point { ...