60 lines
3.1 KiB
Markdown
60 lines
3.1 KiB
Markdown
[range.iota.sentinel]
|
||
|
||
# 25 Ranges library [[ranges]](./#ranges)
|
||
|
||
## 25.6 Range factories [[range.factories]](range.factories#range.iota.sentinel)
|
||
|
||
### 25.6.4 Iota view [[range.iota]](range.iota#sentinel)
|
||
|
||
#### 25.6.4.4 Class iota_view::*sentinel* [range.iota.sentinel]
|
||
|
||
[ð](#lib:iota_view::sentinel)
|
||
|
||
namespace std::ranges {template<[weakly_incrementable](iterator.concept.winc#concept:weakly_incrementable "24.3.4.4 Concept weakly_incrementable [iterator.concept.winc]") W, [semiregular](concepts.object#concept:semiregular "18.6 Object concepts [concepts.object]") Bound>requires [*weakly-equality-comparable-with*](concept.equalitycomparable#concept:weakly-equality-comparable-with "18.5.4 Concept equality_comparable [concept.equalitycomparable]")<W, Bound> && [copyable](concepts.object#concept:copyable "18.6 Object concepts [concepts.object]")<W>struct iota_view<W, Bound>::*sentinel* {private: Bound *bound_* = Bound(); // *exposition only*public:*sentinel*() = default; constexpr explicit *sentinel*(Bound bound); friend constexpr bool operator==(const *iterator*& x, const *sentinel*& y); friend constexpr iter_difference_t<W> operator-(const *iterator*& x, const *sentinel*& y)requires [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_sentinel_for [iterator.concept.sizedsentinel]")<Bound, W>; friend constexpr iter_difference_t<W> operator-(const *sentinel*& x, const *iterator*& y)requires [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_sentinel_for [iterator.concept.sizedsentinel]")<Bound, W>; };}
|
||
|
||
[ð](#lib:iota_view::sentinel,constructor)
|
||
|
||
`constexpr explicit sentinel(Bound bound);
|
||
`
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L3515)
|
||
|
||
*Effects*: Initializes *bound_* with bound[.](#1.sentence-1)
|
||
|
||
[ð](#lib:operator==,iota_view::sentinel)
|
||
|
||
`friend constexpr bool operator==(const iterator& x, const sentinel& y);
|
||
`
|
||
|
||
[2](#2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L3526)
|
||
|
||
*Effects*: Equivalent to: return x.*value_* == y.*bound_*;
|
||
|
||
[ð](#lib:operator-,iota_view::sentinel)
|
||
|
||
`friend constexpr iter_difference_t<W> operator-(const iterator& x, const sentinel& y)
|
||
requires [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_sentinel_for [iterator.concept.sizedsentinel]")<Bound, W>;
|
||
`
|
||
|
||
[3](#3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L3538)
|
||
|
||
*Effects*: Equivalent to: return x.*value_* - y.*bound_*;
|
||
|
||
[ð](#lib:operator-,iota_view::sentinel_)
|
||
|
||
`friend constexpr iter_difference_t<W> operator-(const sentinel& x, const iterator& y)
|
||
requires [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_sentinel_for [iterator.concept.sizedsentinel]")<Bound, W>;
|
||
`
|
||
|
||
[4](#4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L3550)
|
||
|
||
*Effects*: Equivalent to: return -(y - x);
|