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分別測試範圍的無限下限和上限。

 

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