What I take to mean can be explained by the following example:
auto p = std::make_shared<int>();
Is the int
variable default initialized (thus have garbage value) or value initialized (thus have a value of zero)? I've tested on GCC 5.2 and clang 3.6 with the former doing value initialization and the latter doing default initialization. I'm wondering what does the standard say about this? In my opinion, modern C++ should definitely perform value initialization in this case.
Aucun commentaire:
Enregistrer un commentaire