From Jason Turner

[range.subrange.access]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpekthf3id/{from.md → to.md} +113 -0
tmp/tmpekthf3id/{from.md → to.md} RENAMED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Accessors <a id="range.subrange.access">[[range.subrange.access]]</a>
2
+
3
+ ``` cpp
4
+ constexpr I begin() const requires copyable<I>;
5
+ ```
6
+
7
+ *Effects:* Equivalent to: `return `*`begin_`*`;`
8
+
9
+ ``` cpp
10
+ [[nodiscard]] constexpr I begin() requires (!copyable<I>);
11
+ ```
12
+
13
+ *Effects:* Equivalent to: `return std::move(`*`begin_`*`);`
14
+
15
+ ``` cpp
16
+ constexpr S end() const;
17
+ ```
18
+
19
+ *Effects:* Equivalent to: `return `*`end_`*`;`
20
+
21
+ ``` cpp
22
+ constexpr bool empty() const;
23
+ ```
24
+
25
+ *Effects:* Equivalent to: `return `*`begin_`*` == `*`end_`*`;`
26
+
27
+ ``` cpp
28
+ constexpr make-unsigned-like-t<iter_difference_t<I>> size() const
29
+ requires (K == subrange_kind::sized);
30
+ ```
31
+
32
+ *Effects:*
33
+
34
+ - If *StoreSize* is `true`, equivalent to: `return `*`size_`*`;`
35
+ - Otherwise, equivalent to:
36
+ `return `*`to-unsigned-like`*`(`*`end_`*` - `*`begin_`*`);`
37
+
38
+ ``` cpp
39
+ [[nodiscard]] constexpr subrange next(iter_difference_t<I> n = 1) const &
40
+ requires forward_iterator<I>;
41
+ ```
42
+
43
+ *Effects:* Equivalent to:
44
+
45
+ ``` cpp
46
+ auto tmp = *this;
47
+ tmp.advance(n);
48
+ return tmp;
49
+ ```
50
+
51
+ ``` cpp
52
+ [[nodiscard]] constexpr subrange next(iter_difference_t<I> n = 1) &&;
53
+ ```
54
+
55
+ *Effects:* Equivalent to:
56
+
57
+ ``` cpp
58
+ advance(n);
59
+ return std::move(*this);
60
+ ```
61
+
62
+ ``` cpp
63
+ [[nodiscard]] constexpr subrange prev(iter_difference_t<I> n = 1) const
64
+ requires bidirectional_iterator<I>;
65
+ ```
66
+
67
+ *Effects:* Equivalent to:
68
+
69
+ ``` cpp
70
+ auto tmp = *this;
71
+ tmp.advance(-n);
72
+ return tmp;
73
+ ```
74
+
75
+ ``` cpp
76
+ constexpr subrange& advance(iter_difference_t<I> n);
77
+ ```
78
+
79
+ *Effects:* Equivalent to:
80
+
81
+ - If *StoreSize* is `true`,
82
+ ``` cpp
83
+ auto d = n - ranges::advance(begin_, n, end_);
84
+ if (d >= 0)
85
+ size_ -= to-unsigned-like(d);
86
+ else
87
+ size_ += to-unsigned-like(-d);
88
+ return *this;
89
+ ```
90
+ - Otherwise,
91
+ ``` cpp
92
+ ranges::advance(begin_, n, end_);
93
+ return *this;
94
+ ```
95
+
96
+ ``` cpp
97
+ template<size_t N, class I, class S, subrange_kind K>
98
+ requires (N < 2)
99
+ constexpr auto get(const subrange<I, S, K>& r);
100
+ template<size_t N, class I, class S, subrange_kind K>
101
+ requires (N < 2)
102
+ constexpr auto get(subrange<I, S, K>&& r);
103
+ ```
104
+
105
+ *Effects:* Equivalent to:
106
+
107
+ ``` cpp
108
+ if constexpr (N == 0)
109
+ return r.begin();
110
+ else
111
+ return r.end();
112
+ ```
113
+