Is Reference type in C++ a POD type too?
Is int&
is a POD type? and what about
struct Q { int& i; }
Anyone can help me?
There is a standard way (using C++11) to determine that at compile time.
#include
#include
struct Q
{
int& i;
};
int main()
{
std::cout << std::is_pod::value << "\t";
std::cout << std::is_pod::value << "\t";
std::cout << std::is_pod::value << "\n";
}
Demo: http://ideone.com/PECzfT
The output will be 1 0 0, so no a reference to int is not POD.