Q:

How to keep the implicitly declared aggregate initialization constructor?

Suppose I have a class like this:
struct X {
  char buf[10];
};
X x{"abc"};

This compiles.  However, if I add user defined constructors to the class, this implicitly declared aggregate initialization constructor will be deleted:
struct X {
  char buf[10];
  X(int, int) {}
};
X x{"abc"}; // compile error

How can I declare that I want default aggregate initialization constructor, just like that for default constructor X()=default?  Thanks.

A:

There is no "default aggregate initialization constructor".
Aggregate initialization only happens on aggregates. And aggregates are types that, among other things, don't have (user-provided) constructors. What you're asking for is logically impossible.
The correct means of doing what you want is to make a factory function to construct your type in your special way. That way, the type can remain an aggregate, but there's a short-hand way for initializing it the way you want.
You give a type a constructor when you want to force users to call a constructor to construct it. When you don't, you just use factory functions.

