title: Standard Layout c++
body: <p>I was going through great articles on <a href="https://stackoverflow.com/questions/4178175/what-are-aggregates-and-pods-and-how-why-are-they-special">C++ POD, Trivial and Standard Layout classes</a>
  One property I haven't clearly understood about standard layout is the following:-</p>
  
  <pre><code> A standard layout has no base classes of the same type as the first 
      non-static data member
  </code></pre>
  
  <p>So the following will not be a Standard Layout as it has the first member same as the base class</p>
  
  <pre><code>struct NonStandardLayout3 : StandardLayout1 {
      StandardLayout1 x; // first member cannot be of the same type as base
  };
  </code></pre>
  
  <p>But performance-wise and property-wise how is the above struct any different than</p>
  
  <pre><code>struct StandardLayout5 : StandardLayout1 {
      int x;
      StandardLayout1 y; // can have members of base type if they're not the first   
  };
  </code></pre>
  
  <p>which is the correction of the one above this.</p>