lundi 20 avril 2020

what is the difference between trivial and non trivial objects

I am actually not sure to understand the difference between a trivial and non-trivial object. It is said here that a trivial object:

  • occupies a contiguous memory area
  • does not contains user-provided constructor/operator/destructor.

but are objects automatically aligning data in memory ? what if it meets both points but there is methods ? is there something related to POD ?

"trivial" sounds to me like something that can be used kind of the same way as a simple type. But i guess it is more complicated than that.

Aucun commentaire:

Enregistrer un commentaire