I'm intrigued by the following paragraph from the standard (§3.9/4 of ISO/IEC 14882:2011(E)):
The object representation of an object of type
T
is the sequence of Nunsigned char
objects taken up by the object of typeT
, where N equalssizeof(T)
. The value representation of an object is the set of bits that hold the value of typeT
. For trivially copyable types, the value representation is a set of bits in the object representation that determines a value, which is one discrete element of an implementation-defined set of values.42
I understand that the object representation and value representation are distinct to allow some of the object representation to not take part in the value of the object (for example, padding). I don't quite get the point about trivially copyable types though. Do non-trivially copyable types not have values? Can part of the value representation of a non-trivially copyable type exist outside its object representation?
Note 42 explains:
The intent is that the memory model of C++ is compatible with that of ISO/IEC 9899 Programming Language C.
I still don't understand why the previous statement is specifically for trivially copyable types only though. What is the significance of this?