从 Cppreference.com开始(因为 OP 被标记为 C + + 11,我排除了 C + + 14和 C + + 17中的规则; 请参考链接了解更多细节) :
如果大括号 init-list 为空,而 t 是带有缺省构造函数的类类型,则执行值初始化。
Otherwise, if T is an aggregate type, aggregate initialization is performed.
否则,如果 T 是 std: : initializer _ list 的专门化,则 T 对象将从支撑的 init-list 中直接初始化或复制初始化(取决于上下文)。
Otherwise, the constructors of T are considered, in two phases:
检查所有将 std: : initializer _ list 作为唯一参数的构造函数,或者如果其余参数具有默认值,则将其作为第一个参数的构造函数,并通过重载解析对单个类型为 std: : initializer _ list 的参数进行匹配
If the previous stage does not produce a match, all constructors of T participate in overload resolution against the set of arguments that consists of the elements of the braced-init-list, with the restriction that only non-narrowing conversions are allowed. If this stage produces an explicit constructor as the best match for a copy-list-initialization, compilation fails (note, in simple copy-initialization, explicit constructors are not considered at all).
否则(如果 T 不是类类型) ,如果大括号初始化列表只有一个元素,并且 T 不是引用类型或者是与元素类型兼容的引用类型,则 T 是直接初始化(在直接列表初始化中)或复制初始化(在拷贝列表初始化中) ,除非不允许进行收缩转换。
If T is a class type with a user-provided default constructor, that constructor is called.
If T is a class type with an implicitly-defined, or = defaulted default constructor, the object is zero-initialized and then the default constructor is called.