94 lines
5.4 KiB
Markdown
94 lines
5.4 KiB
Markdown
[range.zip.sentinel]
|
||
|
||
# 25 Ranges library [[ranges]](./#ranges)
|
||
|
||
## 25.7 Range adaptors [[range.adaptors]](range.adaptors#range.zip.sentinel)
|
||
|
||
### 25.7.25 Zip view [[range.zip]](range.zip#sentinel)
|
||
|
||
#### 25.7.25.4 Class template zip_view::*sentinel* [range.zip.sentinel]
|
||
|
||
[ð](#lib:zip_view::sentinel)
|
||
|
||
namespace std::ranges {template<[input_range](range.refinements#concept:input_range "25.4.6 Other range refinements [range.refinements]")... Views>requires ([view](range.view#concept:view "25.4.5 Views [range.view]")<Views> && ...) && (sizeof...(Views) > 0)template<bool Const>class zip_view<Views...>::*sentinel* { tuple<sentinel_t<*maybe-const*<Const, Views>>...> *end_*; // *exposition only*constexpr explicit *sentinel*(tuple<sentinel_t<*maybe-const*<Const, Views>>...> end); // *exposition only*public:*sentinel*() = default; constexpr *sentinel*(*sentinel*<!Const> i)requires Const && ([convertible_to](concept.convertible#concept:convertible_to "18.4.4 Concept convertible_to [concept.convertible]")<sentinel_t<Views>, sentinel_t<const Views>> && ...); template<bool OtherConst>requires ([sentinel_for](iterator.concept.sentinel#concept:sentinel_for "24.3.4.7 Concept sentinel_for [iterator.concept.sentinel]")<sentinel_t<*maybe-const*<Const, Views>>,
|
||
iterator_t<*maybe-const*<OtherConst, Views>>> && ...)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<*maybe-const*<Const, Views>>,
|
||
iterator_t<*maybe-const*<OtherConst, Views>>> && ...)friend constexpr common_type_t<range_difference_t<*maybe-const*<OtherConst, Views>>...>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<*maybe-const*<Const, Views>>,
|
||
iterator_t<*maybe-const*<OtherConst, Views>>> && ...)friend constexpr common_type_t<range_difference_t<*maybe-const*<OtherConst, Views>>...>operator-(const *sentinel*& y, const *iterator*<OtherConst>& x); };}
|
||
|
||
[ð](#lib:zip_view::sentinel,constructor)
|
||
|
||
`constexpr explicit sentinel(tuple<sentinel_t<maybe-const<Const, Views>>...> end);
|
||
`
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L11910)
|
||
|
||
*Effects*: Initializes *end_* with end[.](#1.sentence-1)
|
||
|
||
[ð](#lib:zip_view::sentinel,constructor_)
|
||
|
||
`constexpr sentinel(sentinel<!Const> i)
|
||
requires Const && ([convertible_to](concept.convertible#concept:convertible_to "18.4.4 Concept convertible_to [concept.convertible]")<sentinel_t<Views>, sentinel_t<const Views>> && ...);
|
||
`
|
||
|
||
[2](#2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L11922)
|
||
|
||
*Effects*: Initializes *end_* with std::move(i.*end_*)[.](#2.sentence-1)
|
||
|
||
[ð](#lib:operator==,zip_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<maybe-const<Const, Views>>,
|
||
iterator_t<maybe-const<OtherConst, Views>>> && ...)
|
||
friend constexpr bool operator==(const iterator<OtherConst>& x, const sentinel& y);
|
||
`
|
||
|
||
[3](#3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L11936)
|
||
|
||
*Returns*: true if there exists an integer 0â¤i<sizeof...(Views) such that bool(std::get<i>(x.*current_*) == std::get<i>(y.*end_*)) is true[.](#3.sentence-1)
|
||
|
||
Otherwise, false[.](#3.sentence-2)
|
||
|
||
[ð](#lib:operator-,zip_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<maybe-const<Const, Views>>,
|
||
iterator_t<maybe-const<OtherConst, Views>>> && ...)
|
||
friend constexpr common_type_t<range_difference_t<maybe-const<OtherConst, Views>>...>
|
||
operator-(const iterator<OtherConst>& x, const sentinel& y);
|
||
`
|
||
|
||
[4](#4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L11954)
|
||
|
||
Let D be the return type[.](#4.sentence-1)
|
||
|
||
Let *DIST*(i) beD(std::get<i>(x.*current_*) - std::get<i>(y.*end_*))[.](#4.sentence-2)
|
||
|
||
[5](#5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L11959)
|
||
|
||
*Returns*: The value with the smallest absolute value among *DIST*(n) for all integers 0â¤n<sizeof...(Views)[.](#5.sentence-1)
|
||
|
||
[ð](#lib:operator-,zip_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<maybe-const<Const, Views>>,
|
||
iterator_t<maybe-const<OtherConst, Views>>> && ...)
|
||
friend constexpr common_type_t<range_difference_t<maybe-const<OtherConst, Views>>...>
|
||
operator-(const sentinel& y, const iterator<OtherConst>& x);
|
||
`
|
||
|
||
[6](#6)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L11975)
|
||
|
||
*Effects*: Equivalent to: return -(x - y);
|