fork(5) download
  1. #include <iostream>
  2. #include <type_traits>
  3.  
  4.  
  5. struct base_pod_t {
  6. unsigned x;
  7. };
  8.  
  9. struct der_pod_t : public base_pod_t { };
  10.  
  11. int main()
  12. {
  13. std::cout << "base_pod_t is POD: " << std::is_pod<base_pod_t>::value << std::endl;
  14. std::cout << "der_pod_t is POD: " << std::is_pod<der_pod_t>::value << std::endl;
  15. base_pod_t b1 = {}; // OK
  16. base_pod_t b2 = {3}; // OK
  17.  
  18. der_pod_t p1 = {}; // OK
  19. // der_pod_t p2 = {4}; // ERROR!
  20. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
base_pod_t is POD: 1
der_pod_t  is POD: 1