A POD struct can be zero-initialized in C++11 as follows:
SomeStruct s{};
However, what do I do if I already have an instance of the struct and I want to re-initialize it to zeros? The following seems to work:
s = {};
Can someone point out the relevant standardese? I assume this is what is happening:
- A new zero-initialized instance gets created.
- The new instance is assigned to the existing instance, invoking the implicit assignment operator.
Aucun commentaire:
Enregistrer un commentaire