struct A1
{
~A1() {} // A1 is not trivially destructible
};
struct A2
{
~A2() = default; // A2 is trivially destructible
};
A2
is better than A1
, because A2
is trivially destructible while A1
isn't.
I think maybe we can safely say:
1. The user-defined empty destructor should never be used.
2. Any user-defined empty destructor should be replaced with the defaulted one.
Am I right?
Aucun commentaire:
Enregistrer un commentaire