is_pod Class
Tests if type is a POD.
template<class Ty>
struct is_pod;
Parameters
- Ty
The type to query.
Remarks
An instance of the type predicate holds true if the type Ty is a scalar type, a POD aggregate type, or a cv-qualified form of one of them, or an array of such a type, otherwise it holds false.
A POD aggregate type is a class, struct, or union whose non-static data members are all scalar types or POD aggregates, and that has no references, no user-defined copy assignment operator, and no user-defined destructor.
Example
// std_tr1__type_traits__is_pod.cpp
// compile with: /EHsc
#include <type_traits>
#include <iostream>
struct trivial
{
int val;
};
struct throws
{
throws() throw(int)
{
}
throws(const throws&) throw(int)
{
}
throws& operator=(const throws&) throw(int)
{
}
int val;
};
int main()
{
std::cout << "is_pod<trivial> == " << std::boolalpha
<< std::tr1::is_pod<trivial>::value << std::endl;
std::cout << "is_pod<int> == " << std::boolalpha
<< std::tr1::is_pod<int>::value << std::endl;
std::cout << "is_pod<throws> == " << std::boolalpha
<< std::tr1::is_pod<throws>::value << std::endl;
return (0);
}
is_pod<trivial> == true is_pod<int> == true is_pod<throws> == false
Requirements
Header: <type_traits>
Namespace: std::tr1