stavo attraversando grandi articoli sul C++ POD, Trivial and Standard Layout classes Una proprietà che non ho ben capito di layout standard è la seguente: -standard layout C++
A standard layout has no base classes of the same type as the first
non-static data member
Quindi quanto segue non sarà un layout standard in quanto ha il primo elemento stesso della classe base
struct NonStandardLayout3 : StandardLayout1 {
StandardLayout1 x; // first member cannot be of the same type as base
};
Ma riguarda le prestazioni e proprietà-saggio com'è struct sopra qualsiasi diverso
struct StandardLayout5 : StandardLayout1 {
int x;
StandardLayout1 y; // can have members of base type if they're not the first
};
che è la correzione di quello sopra questo.
correlati [post] (http://stackoverflow.com/q/7160901/183120). – legends2k