8.17.4. Infinite (Unbounded) Ranges

8.17.4. Infinite (Unbounded) Ranges

8.17.4. 无限(无界)范围

The lower bound of a range can be omitted, meaning that all points less than the upper bound are included in the range. Likewise, if the upper bound of the range is omitted, then all points greater than the lower bound are included in the range. If both lower and upper bounds are omitted, all values of the element type are considered to be in the range.

范围的下限可以省略,这意味着所有小于上限的点都包含在范围内。同样,如果省略范围的上限,则所有大于下限的点都将包含在范围内。如果上限和下限均被忽略,则元素类型的所有值均视为在范围内。

 

This is equivalent to considering that the lower bound is “minus infinity”, or the upper bound is “plus infinity”, respectively. But note that these infinite values are never values of the range's element type,and can never be part of the range. (So there is no such thing as an inclusive infinite bound — if you try to write one, it will automatically be converted to an exclusive bound.)

这等效于分别考虑下限为“负无穷大”或上限为“正无穷大”。 但是请注意,这些无穷值永远不是范围元素类型的值,也永远不能成为范围的一部分。(因此,不存在包含无穷大的边界—如果您尝试编写一个无穷大边界,它将自动转换为排他边界。)

 

Also, some element types have a notion of “infinity”, but that is just another value so far as the range type mechanisms are concerned. For example, in timestamp ranges, [today,] means the same thing as [today,). But [today,infinity] means something different from [today,infinity) — the latter excludes the special timestamp value infinity.

同样,某些元素类型具有“无穷大”的概念,但是就范围类型机制而言,这只是另一个值。 例如,在时间戳范围内,[今天]的含义与[今天]相同。 但是[today,infinity]的含义不同于[today,infinity)-后者排除了特殊的时间戳值infinity。

 

The functions lower_inf and upper_inf test for infinite lower and upper bounds of a range,respectively.

函数lower_inf和upper_inf分别测试范围的无限下限和上限。

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章