Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.

libs/type_traits/doc/is_pod.qbk

[/ 
  Copyright 2007 John Maddock.
  Distributed under the Boost Software License, Version 1.0.
  (See accompanying file LICENSE_1_0.txt or copy at
  http://www.boost.org/LICENSE_1_0.txt).
]

[section:is_pod is_pod]
   template <class T>
   struct is_pod : public __tof {};
  
__inherit If T is a (possibly cv-qualified) POD type then inherits from __true_type, 
otherwise inherits from __false_type.

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.

__std_ref 3.9p10 and 9p4 (Note that POD's are also aggregates, see 8.5.1).

__compat If the compiler does not support partial-specialization 
of class templates, then this template can not be used with function types.

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 (May 2005) only MWCW 9 and Visual C++ 8 have the 
necessary compiler-__intrinsics.

__header ` #include <boost/type_traits/is_pod.hpp>` or ` #include <boost/type_traits.hpp>`

__examples

[:`is_pod<int>` inherits from `__true_type`.]

[:`is_pod<char*>::type` is the type `__true_type`.]

[:`is_pod<int (*)(long)>::value` is an integral constant 
expression that evaluates to /true/.]

[:`is_pod<MyClass>::value` is an integral constant 
expression that evaluates to /false/.]

[:`is_pod<T>::value_type` is the type `bool`.]

[endsect]