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?
A POD type is any intrinsic type or aggregate of intrinsic types (basically, anything that does not have a custom constructor, destructor, copy-constructor, copy-assignment operator, nor non-static pointer-to-member types (more details here)
Since a member that references something must be set via a custom constructor, it would violate the first requirement. In short, a struct that declares a reference type as a member is not a POD type.