fork download
  1. #include <type_traits>
  2. #include <iostream>
  3.  
  4. struct Foo {
  5. Foo() : x(0), y(0) {}
  6. int x;
  7. int y;
  8. };
  9.  
  10. struct Bar {
  11. Bar() = default;
  12. int x;
  13. int y;
  14. };
  15.  
  16. // Apparently the following two lines are not "static initialization" because
  17. // Foo is non-POD yet we can still do this:
  18. Foo f;
  19. Bar b;
  20.  
  21. int main()
  22. {
  23. if (std::is_pod<Foo>::value) std::cout << "Foo is a POD" << std::endl;
  24. else std::cout << "Foo is *not* a POD" << std::endl;
  25.  
  26. if (std::is_pod<Bar>::value) std::cout << "Bar is a POD" << std::endl;
  27. else std::cout << "Bar is *not* a POD" << std::endl;
  28. }
Success #stdin #stdout 0s 2896KB
stdin
Standard input is empty
stdout
Foo is *not* a POD
Bar is a POD