When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
12 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
Unordered maps will 0 initialize new primative values from []
Basically you can imagine primatives having a default constructor that has garbage and an explicit default constructor that initializes to 0;
Nooo I meant to copy that not delete :(
;compile
int x;
int y{};
printf("%d %d\n", x, y);
1651076199 0
There we go
1651076199 0
Thank you and let us know if you have any more questions!
This thread is now set to auto-hide after an hour of inactivity
Just final statements
In the docs for [] it mentions in regards to new values
this results in the key being copy constructed from key and the mapped value being value-initialized
Value-initialization refers to this
https://en.cppreference.com/w/cpp/language/value_initialization
Basically what I talked about. Primatives are set to 0, classes are default constructed. trivial classes are also set to all 0s