Is this struct a POD in C++11?
struct B
{
int a;
B(int aa) : a(aa) {}
B() = default;
};
Note that this question is explicit about C++11. I know that this class is not a POD in C++98 nor C++03.
For an explanation of POD in C++11, see trivial vs. standard layout vs. POD
(Inspired by this question: Is there a compile-time func/macro to determine if a C++0x struct is POD? )
Yes, it is a POD according to the new rules.
If you look up paragraph §8.4.2/4 of the new standard, you can see that if a constructor is defaulted on the first declaration, it is not user-provided:
You can use the
std::is_podtype trait to have the compiler test this for you withstatic_assert.