Using auto with initializer list.
对初始化器列表使用auto。
Listing 12 shows how you traverse an initializer list.
清单12说明如何访问初始化器列表。
Before moving on to initializer list examples and typical usage, let's look at what is meant by type narrowing.
在研究初始化器列表示例和典型用法之前,先讨论一下什么是类型窄化。
A constructor initializer list specifies initial values for one or more data members of the class.
构造函数的初始化列表为类的一个或多个数据成员指定初值。
The members are initialized to the values specified in the initializer list before the body of the constructor executes.
在构造函数体现执行前,用初始化列表中指定的值初始化成员。
Class members that are not initialized in the initializer list are implicitly initialized by using their default constructor.
没有在初始化列表中初始化的类成员,使用它们的默认构造函数隐式初始化。
Class members that are not initialized in the initializer list are implicitly initialized by using their default constructor.
没有在初始化列表中初始化的类成员,使用它们的默认构造函数隐式初始化。
应用推荐