Is it possible to invoke aggregate initialization within my own definition of the default ctor?
GCC complains "error: constructor delegates to itself" with the below code:
struct X {
int x, y, z, p, q, r;
X(): x{}, y{}, z{}, p{}, q{}, r{} { } // cumbersome
//X(): X{} { } // the idea is nice but doesn't compile
};
I'm using memset(this, 0, sizeof(*this)) in the ctor body at the moment.
One way would be to fool overload resolution in the following way:
Another way would be to use in-class default member initialization:
In your specific example you could also do: