|
|
|
|
|
by William_BB
6 days ago
|
|
If my understanding is correct, C++ built-in types can be declared without initializing them: int x; // Unitialized, garbage value
int x{}; // Value-initialized (falls back to zero-initialization)
We want classes to have the same behaviour: Struct s; // Default-initializes (presumably we want members uninitialized)
Struct s{}; // Value-initializes (presumably we want members initialized)
|
|