Of initializer lists and type narrowing
初始化器列表和类型窄化(type narrowing)
Before moving on to initializer list examples and typical usage, let's look at what is meant by type narrowing.
在研究初始化器列表示例和典型用法之前,先讨论一下什么是类型窄化。
Note that int y(2.3) is allowed in C++0x; no type narrowing is assumed, and y equals 2 while int y{2.3} is plain error.
注意,在 C++0x 中允许inty(2.3);由于不允许类型窄化,y等于2,而 int y{2.3}是错的。
It's okay to use initializer lists to initialize scalar variables, and the usual rule of type narrowing applies in such cases.
可以使用初始化器列表对标量变量进行初始化,在这种情况下应用一般的类型窄化规则。
Narrowing search results by source and type of media also has great implications for individual productivity.
通过媒体来源和类型缩小搜索范围也可以大大提高个人工作效率。
The args clause binds to argument (s) in methods being matched, implicitly narrowing to methods that have a first argument of type String.
args子句绑定到被匹配的方法中的参数,缩小范围到具有第一个参数类型是String的方法。
By selecting your preferences from a robust list of options such as location, price, star rating, car type, route, etc, you're narrowing down the inventory.
通过从一个强大的列表,如地点、价格、星级、车型、路线等等中选择了自己的偏好,用户可以缩小库存的范围。
The Explorer pane provides filters for narrowing your search results by attributes such as length, screen type, resolution, and source.
浏览窗格根据大小、屏幕类型、分辨率及来源等属性提供了过滤功能来缩小结果范围。
This would only happen if the value were a "narrowing conversion," where a value exceeded the possible range value allowed in the new type, such as trying to convert from long to int, for example.
只有当一个值 “转换为范围更小的类型” 时,即这个值超出了新类型允许的范围,例如试图从long 类型转换为int 类型,才会发生这样的情况。
Type conversions may either be widening or narrowing: widening conversions never overflow and always succeed, whereas narrowing conversions entail the possible loss of information and may fail.
型别转换可以是「扩展」或「缩小」:扩展转换从不会溢位,而且一定成功,但是缩小转换却可能造成资讯遗失,甚至失败。
Again, you must be aware of the effect of a narrowing conversion when casting to a smaller type, otherwise you might unknowingly lose information during the cast.
同样地,当造型成一种较小的类型时,必须留意“缩小转换”的后果。否则会在造型过程中不知不觉地丢失信息。
If you relax the type-conversion rule, the compiler operates under permissive type semantics, which allows you to make narrowing conversions without conversion keywords.
如果放宽类型转换规则,则编译器将在“许可类型语义”下操作,该语义允许在不使用转换关键字的情况下进行收缩转换。
The central type was most common seen (71.43%), which often accompanied with narrowing of vertebral canal and lateral recess.
常见突出类型为中央型(71.43%),多伴有先天发育性椎管和侧隐窝狭窄。
The common methods for knitting the V type necks on the common flat knitting machine include narrowing, press-off, combination of narrowing point and narrowing, comb drop narrowing, and so on.
在普通横机上编织毛衫V形领圈常见的方法有收针法、拷针法、套针收针结合法和落梳收针法等。
A conversion of one array type to another is widening or narrowing depending on whether the conversion of the respective elements is widening or narrowing.
一种数组类型到另一种数组类型的转换是扩展转换还是双字节到单字节转换,取决于各自元素的转换是扩展转换还是双字节到单字节转换。
A procedure is called with an argument that widens to the corresponding parameter type, and the conversion from the parameter to the argument is narrowing.
调用过程时使用扩大到对应参数类型的变量,从参数到变量的转换则为缩小转换。
A procedure is called with an argument that widens to the corresponding parameter type, and the conversion from the parameter to the argument is narrowing.
调用过程时使用扩大到对应参数类型的变量,从参数到变量的转换则为缩小转换。
应用推荐