Possible Duplicate:
What are Aggregates and PODs and how/why are they special?
What kind of constructors can structs in C++11 have to keep this struct as POD?
Only initializer-list acceptable? Or maybe there are no any restrictions?
Possible Duplicate:
What are Aggregates and PODs and how/why are they special?
What kind of constructors can structs in C++11 have to keep this struct as POD?
Only initializer-list acceptable? Or maybe there are no any restrictions?
You need a defaulted default constructor so that it is trivial:
struct pot
{
constexpr pot() noexcept = default;
pot(int a, float b) : x(a), y(b) { }
int x;
float y;
};
The constexpr
and noexcept
are optional, but we might as well.
Usage:
pot p; // OK
pot q(1, 1.5); // also OK