Using auto with initializer list.
对初始化器列表使用auto。
Of initializer lists and type narrowing
初始化器列表和类型窄化(type narrowing)
Listing 2 shows a typical static initializer.
清单2显示了典型的静态初始化器。
Listing 12 shows how you traverse an initializer list.
清单12说明如何访问初始化器列表。
In an initializer block, which executes just before the constructor.
在一个初始化块中,仅在构造函数之前执行。
The constructor that is used when no initializer is specified.
没有指定初始化时使用的构造函数。
Such a representation is also called an object initializer in Rhino.
这种表示在Rhino中也称为对象初始化。
In a static initializer block, which executes when the class is loaded.
在一个静态初始化块中,在加载类时执行。
Welcome to the new auto syntax: type deduction from initializer expressions.
新的auto语法:根据初始化器(initializer)表达式推导类型。
The same rules hold true if the exception is thrown from a static field initializer.
如果异常是从静态字段初始值设定项引发的,也存在同样的规则。
In the case of PHP, the arguments to this object initializer are path, host and port.
就php来说,这个对象初始化器的参数是path、host和port。
Given this kind of semantics, using initializer lists should be preferred whenever possible.
由于采用这种语义,应该尽可能使用初始化器列表。
An object initializer specifies values for one or more fields or properties of an object.
对象初始化器指定一个或多个对象的域或属性的值。
A constructor initializer list specifies initial values for one or more data members of the class.
构造函数的初始化列表为类的一个或多个数据成员指定初值。
As you saw earlier, the code for a static field initializer executes inside an implicit type constructor.
正如您在前面看到的那样,静态字段初始值设定项的代码在隐式类型构造函数的内部执行。
When we define a variable without an initializer, the system sometimes initializes the variable for us.
当定义没有初始化式的变量时,系统有时候会帮我们初始化变量。
The metaclass will create the class (as a new style one) and will pass it to the class initializer procedure.
元类将创建此类(作为一个新式类)并将其传递给类初始化器过程。
The static initializer runs first, as the class is loaded, followed by the main method (which is also static).
加载类之后,静态初始化器首先运行,紧接着运行的是main方法(也是静态的)。
Before moving on to initializer list examples and typical usage, let's look at what is meant by type narrowing.
在研究初始化器列表示例和典型用法之前,先讨论一下什么是类型窄化。
It's okay to use initializer lists to initialize scalar variables, and the usual rule of type narrowing applies in such cases.
可以使用初始化器列表对标量变量进行初始化,在这种情况下应用一般的类型窄化规则。
Class members that are not initialized in the initializer list are implicitly initialized by using their default constructor.
没有在初始化列表中初始化的类成员,使用它们的默认构造函数隐式初始化。
The constructor initializer is a list of member names, each of which is followed by that member's initial value in parentheses.
构造函数的初始化式是一系列成员名,每个成员后面是括在圆括号中的初始值。
Metadata about operations, references, and basic attributes are initialized in a static block initializer, as shown in Listing 3.
有关操作、引用以及基本属性的元数据在一个静态初始程序块中被初始化,如清单3所示。
The static initializer in Listing 2 shows the registration process for a Customer class that contains two properties: name and salary.
清单2中的静态初始化器显示了Customer类的注册过程,这个类包含两个属性:name和salary。
The static initializer in Listing 2 shows the registration process for a Customer class that contains two properties: name and salary.
清单2中的静态初始化器显示了Customer类的注册过程,这个类包含两个属性:name和salary。
应用推荐