There is also an interesting aspect (which do not seem to be talked about in the linked duplicate) of a triviality of destructor. Compiler-generated (or default
ed) destructors are considered trivial destructors, and having a trivial destructor is a pre-requisite of your class being a POD-type. The user-defined destructor, even if empty, prevents your class from being a POD-type.
And having a POD-type is sometimes very important. For example, POD-types can be memcpy
ed or entity-serialized.
No comments:
Post a Comment