89 lines
5.4 KiB
Markdown
89 lines
5.4 KiB
Markdown
[range.elements.sentinel]
|
||
|
||
# 25 Ranges library [[ranges]](./#ranges)
|
||
|
||
## 25.7 Range adaptors [[range.adaptors]](range.adaptors#range.elements.sentinel)
|
||
|
||
### 25.7.23 Elements view [[range.elements]](range.elements#sentinel)
|
||
|
||
#### 25.7.23.4 Class template elements_view::*sentinel* [range.elements.sentinel]
|
||
|
||
[ð](#lib:elements_view::sentinel)
|
||
|
||
namespace std::ranges {template<[input_range](range.refinements#concept:input_range "25.4.6 Other range refinements [range.refinements]") V, size_t N>requires [view](range.view#concept:view "25.4.5 Views [range.view]")<V> && [*has-tuple-element*](range.elements.view#concept:has-tuple-element "25.7.23.2 Class template elements_view [range.elements.view]")<range_value_t<V>, N> &&[*has-tuple-element*](range.elements.view#concept:has-tuple-element "25.7.23.2 Class template elements_view [range.elements.view]")<remove_reference_t<range_reference_t<V>>, N> &&[*returnable-element*](range.elements.view#concept:returnable-element "25.7.23.2 Class template elements_view [range.elements.view]")<range_reference_t<V>, N>template<bool Const>class elements_view<V, N>::*sentinel* {private:using *Base* = *maybe-const*<Const, V>; // *exposition only* sentinel_t<*Base*> *end_* = sentinel_t<*Base*>(); // *exposition only*public:*sentinel*() = default; constexpr explicit *sentinel*(sentinel_t<*Base*> end); constexpr *sentinel*(*sentinel*<!Const> other)requires Const && [convertible_to](concept.convertible#concept:convertible_to "18.4.4 Concept convertible_to [concept.convertible]")<sentinel_t<V>, sentinel_t<*Base*>>; constexpr sentinel_t<*Base*> base() const; template<bool OtherConst>requires [sentinel_for](iterator.concept.sentinel#concept:sentinel_for "24.3.4.7 Concept sentinel_for [iterator.concept.sentinel]")<sentinel_t<*Base*>, iterator_t<*maybe-const*<OtherConst, V>>>friend constexpr bool operator==(const *iterator*<OtherConst>& x, const *sentinel*& y); template<bool OtherConst>requires [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_sentinel_for [iterator.concept.sizedsentinel]")<sentinel_t<*Base*>, iterator_t<*maybe-const*<OtherConst, V>>>friend constexpr range_difference_t<*maybe-const*<OtherConst, V>>operator-(const *iterator*<OtherConst>& x, const *sentinel*& y); template<bool OtherConst>requires [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_sentinel_for [iterator.concept.sizedsentinel]")<sentinel_t<*Base*>, iterator_t<*maybe-const*<OtherConst, V>>>friend constexpr range_difference_t<*maybe-const*<OtherConst, V>>operator-(const *sentinel*& x, const *iterator*<OtherConst>& y); };}
|
||
|
||
[ð](#lib:elements_view::sentinel,constructor)
|
||
|
||
`constexpr explicit sentinel(sentinel_t<Base> end);
|
||
`
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L10717)
|
||
|
||
*Effects*: Initializes *end_* with end[.](#1.sentence-1)
|
||
|
||
[ð](#lib:elements_view::sentinel,constructor_)
|
||
|
||
`constexpr sentinel(sentinel<!Const> other)
|
||
requires Const && [convertible_to](concept.convertible#concept:convertible_to "18.4.4 Concept convertible_to [concept.convertible]")<sentinel_t<V>, sentinel_t<Base>>;
|
||
`
|
||
|
||
[2](#2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L10729)
|
||
|
||
*Effects*: Initializes *end_* with std::move(other.*end_*)[.](#2.sentence-1)
|
||
|
||
[ð](#lib:base,elements_view::sentinel)
|
||
|
||
`constexpr sentinel_t<Base> base() const;
|
||
`
|
||
|
||
[3](#3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L10740)
|
||
|
||
*Effects*: Equivalent to: return *end_*;
|
||
|
||
[ð](#lib:operator==,elements_view::sentinel)
|
||
|
||
`template<bool OtherConst>
|
||
requires [sentinel_for](iterator.concept.sentinel#concept:sentinel_for "24.3.4.7 Concept sentinel_for [iterator.concept.sentinel]")<sentinel_t<Base>, iterator_t<maybe-const<OtherConst, V>>>
|
||
friend constexpr bool operator==(const iterator<OtherConst>& x, const sentinel& y);
|
||
`
|
||
|
||
[4](#4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L10753)
|
||
|
||
*Effects*: Equivalent to: return x.*current_* == y.*end_*;
|
||
|
||
[ð](#lib:operator-,elements_view::sentinel)
|
||
|
||
`template<bool OtherConst>
|
||
requires [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_sentinel_for [iterator.concept.sizedsentinel]")<sentinel_t<Base>, iterator_t<maybe-const<OtherConst, V>>>
|
||
friend constexpr range_difference_t<maybe-const<OtherConst, V>>
|
||
operator-(const iterator<OtherConst>& x, const sentinel& y);
|
||
`
|
||
|
||
[5](#5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L10767)
|
||
|
||
*Effects*: Equivalent to: return x.*current_* - y.*end_*;
|
||
|
||
[ð](#lib:operator-,elements_view::sentinel_)
|
||
|
||
`template<bool OtherConst>
|
||
requires [sized_sentinel_for](iterator.concept.sizedsentinel#concept:sized_sentinel_for "24.3.4.8 Concept sized_sentinel_for [iterator.concept.sizedsentinel]")<sentinel_t<Base>, iterator_t<maybe-const<OtherConst, V>>>
|
||
friend constexpr range_difference_t<maybe-const<OtherConst, V>>
|
||
operator-(const sentinel& x, const iterator<OtherConst>& y);
|
||
`
|
||
|
||
[6](#6)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L10781)
|
||
|
||
*Effects*: Equivalent to: return x.*end_* - y.*current_*;
|