Using auto with initializer list.
对初始化器列表使用auto。
Of initializer lists and type narrowing
初始化器列表和类型窄化(type narrowing)
Listing 2 shows a typical static initializer.
清单2显示了典型的静态初始化器。
This is an example of an instance initializer.
这是一个关于实例初始值设定项的示例。
A type will gain a type initializer in two scenarios.
类型在两种情况下会获取类型初始值设定项。
Listing 12 shows how you traverse an initializer list.
清单12说明如何访问初始化器列表。
In an initializer block, which executes just before the constructor.
在一个初始化块中,仅在构造函数之前执行。
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。
We use the EmbeddedDriver for our driver class in the static initializer of the class.
我们将在类的静态初始化器中把 EmbeddedDriver 用于驱动程序类。
Given this kind of semantics, using initializer lists should be preferred whenever possible.
由于采用这种语义,应该尽可能使用初始化器列表。
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.
可以使用初始化器列表对标量变量进行初始化,在这种情况下应用一般的类型窄化规则。
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 wordform_handler class has an initializer and keeps track of the parameter passed in to determine whether to apply XSLT to XML results.
wordform_handler类有一个初始化器,并记录传递的参数,决定是否对XML结果应用XSLT。
A permissions class with a static initializer provides a single location for declaring and configuring available application permissions.
带有静态初始化器的permissions类为声明和配置可用的应用程序权限提供单一位置。
The designated initializer syntax allows you to initialize members by name, without regard to the order in which they appear in an object.
指定的初始化程序语法允许您通过名字初始化成员,不用理会它们在对象中出现的顺序。
The second scenario is when a type has a initializer for a static field, in which case the compiler adds a type constructor behind the scenes.
第二种情况是,类型具有一个用于静态字段的初始值设定项,在这种情况下,编译器会在后台添加类型构造函数。
If the initializer is a bytes literal, you need not specify the encoding type: Remember, bytes literals are not strings. But like strings, you can concatenate bytes.
如果初始化器是一个bytesliteral,则无须指定编码类型:请记住,bytesliteral并不是字符串。
The first set of enclosing braces delineates the construction of an anonymous inner class, and the second set delineates the instance initializer for the anonymous inner class.
第一组闭合括弧划定一个匿名内部类的构造,第二组划定匿名内部类的实例初始化语句块。
Initializer lists in new expressions.
可以在new表达式中使用初始化器列表。
应用推荐