fork download
  1. #include <iostream>
  2.  
  3. struct MyPod { int a; };
  4. struct MyOtherPod { int a; MyOtherPod() : a(1) {} };
  5. struct DefaultPod { int a = 1; }; // makes default ctor non-trivial => non-pod
  6.  
  7.  
  8. int main() {
  9. std::cout << "MyPod " << std::is_pod<MyPod>::value << "\n";
  10. std::cout << "MyOtherPod " << std::is_pod<MyOtherPod>::value << "\n";
  11. std::cout << "DefaultPod " << std::is_pod<DefaultPod>::value << "\n";
  12.  
  13. return 0;
  14. }
Success #stdin #stdout 0s 3140KB
stdin
Standard input is empty
stdout
MyPod 1
MyOtherPod 0
DefaultPod 0