fork(1) download
  1. #include <cstddef>
  2. #include <iomanip>
  3. #include <iostream>
  4. #include <type_traits>
  5.  
  6. struct S1 {
  7. ~S1(){}
  8. int a;
  9. char b;
  10. };
  11.  
  12. struct S3 : S1 {
  13. char c;
  14. };
  15.  
  16. int main()
  17. {
  18. std::cout << sizeof(S1) << "\n";
  19. std::cout << sizeof(S3) << "\n";
  20. std::cout << std::boolalpha << std::is_standard_layout<S1>::value << "\n";
  21. std::cout << std::boolalpha << std::is_standard_layout<S3>::value << "\n";
  22. //std::cout << std::boolalpha << std::is_trivially_copyable<S1>::value << "\n";
  23. //std::cout << std::boolalpha << std::is_trivially_copyable<S3>::value << "\n";
  24. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
8
8
true
false