template <class T> struct is_pod : public
POD stands for "Plain old data". Arithmetic types, and enumeration types, a pointers and pointer to members are all PODs. Classes and unions can also be POD's if they have no non-static data members that are of reference or non-POD type, no user defined constructors, no user defined assignment operators, no private or protected non-static data members, no virtual functions and no base classes. Finally, a cv-qualified POD is still a POD, as is an array of PODs.
C++ Standard Reference: 3.9p10 and 9p4 (Note that POD's are also aggregates, see 8.5.1).
Compiler Compatibility: Without some (as
yet unspecified) help from the compiler, is_pod will never report that a
class or struct is a POD; this is always safe, if possibly sub-optimal. Currently
(June 2015) compilers more recent than Visual C++ 8, Clang-3, GCC-4.3, Greenhills
6.0, Intel-11.0, and Codegear have the necessary compiler intrinsics
to ensure that this trait "just works". You may also test to see
if the necessary intrinsics
are available by checking to see if the macro
is_pod<char*>::typeis the type
is_pod<int (*)(long)>::valueis an integral constant expression that evaluates to true.
is_pod<MyClass>::valueis an integral constant expression that evaluates to false.
is_pod<T>::value_typeis the type