From Jason Turner

[counted.iter.nav]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp8ajdla2k/{from.md → to.md} +148 -0
tmp/tmp8ajdla2k/{from.md → to.md} RENAMED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Navigation <a id="counted.iter.nav">[[counted.iter.nav]]</a>
2
+
3
+ ``` cpp
4
+ constexpr counted_iterator& operator++();
5
+ ```
6
+
7
+ *Preconditions:* `length > 0`.
8
+
9
+ *Effects:* Equivalent to:
10
+
11
+ ``` cpp
12
+ ++current;
13
+ --length;
14
+ return *this;
15
+ ```
16
+
17
+ ``` cpp
18
+ decltype(auto) operator++(int);
19
+ ```
20
+
21
+ *Preconditions:* `length > 0`.
22
+
23
+ *Effects:* Equivalent to:
24
+
25
+ ``` cpp
26
+ --length;
27
+ try { return current++; }
28
+ catch(...) { ++length; throw; }
29
+ ```
30
+
31
+ ``` cpp
32
+ constexpr counted_iterator operator++(int)
33
+ requires forward_iterator<I>;
34
+ ```
35
+
36
+ *Effects:* Equivalent to:
37
+
38
+ ``` cpp
39
+ counted_iterator tmp = *this;
40
+ ++*this;
41
+ return tmp;
42
+ ```
43
+
44
+ ``` cpp
45
+ constexpr counted_iterator& operator--()
46
+ requires bidirectional_iterator<I>;
47
+ ```
48
+
49
+ *Effects:* Equivalent to:
50
+
51
+ ``` cpp
52
+ --current;
53
+ ++length;
54
+ return *this;
55
+ ```
56
+
57
+ ``` cpp
58
+ constexpr counted_iterator operator--(int)
59
+ requires bidirectional_iterator<I>;
60
+ ```
61
+
62
+ *Effects:* Equivalent to:
63
+
64
+ ``` cpp
65
+ counted_iterator tmp = *this;
66
+ --*this;
67
+ return tmp;
68
+ ```
69
+
70
+ ``` cpp
71
+ constexpr counted_iterator operator+(iter_difference_t<I> n) const
72
+ requires random_access_iterator<I>;
73
+ ```
74
+
75
+ *Effects:* Equivalent to:
76
+ `return counted_iterator(current + n, length - n);`
77
+
78
+ ``` cpp
79
+ friend constexpr counted_iterator operator+(
80
+ iter_difference_t<I> n, const counted_iterator& x)
81
+ requires random_access_iterator<I>;
82
+ ```
83
+
84
+ *Effects:* Equivalent to: `return x + n;`
85
+
86
+ ``` cpp
87
+ constexpr counted_iterator& operator+=(iter_difference_t<I> n)
88
+ requires random_access_iterator<I>;
89
+ ```
90
+
91
+ *Preconditions:* `n <= length`.
92
+
93
+ *Effects:* Equivalent to:
94
+
95
+ ``` cpp
96
+ current += n;
97
+ length -= n;
98
+ return *this;
99
+ ```
100
+
101
+ ``` cpp
102
+ constexpr counted_iterator operator-(iter_difference_t<I> n) const
103
+ requires random_access_iterator<I>;
104
+ ```
105
+
106
+ *Effects:* Equivalent to:
107
+ `return counted_iterator(current - n, length + n);`
108
+
109
+ ``` cpp
110
+ template<common_with<I> I2>
111
+ friend constexpr iter_difference_t<I2> operator-(
112
+ const counted_iterator& x, const counted_iterator<I2>& y);
113
+ ```
114
+
115
+ *Preconditions:* `x` and `y` refer to elements of the same
116
+ sequence [[counted.iterator]].
117
+
118
+ *Effects:* Equivalent to: `return y.length - x.length;`
119
+
120
+ ``` cpp
121
+ friend constexpr iter_difference_t<I> operator-(
122
+ const counted_iterator& x, default_sentinel_t);
123
+ ```
124
+
125
+ *Effects:* Equivalent to: `return -x.length;`
126
+
127
+ ``` cpp
128
+ friend constexpr iter_difference_t<I> operator-(
129
+ default_sentinel_t, const counted_iterator& y);
130
+ ```
131
+
132
+ *Effects:* Equivalent to: `return y.length;`
133
+
134
+ ``` cpp
135
+ constexpr counted_iterator& operator-=(iter_difference_t<I> n)
136
+ requires random_access_iterator<I>;
137
+ ```
138
+
139
+ *Preconditions:* `-n <= length`.
140
+
141
+ *Effects:* Equivalent to:
142
+
143
+ ``` cpp
144
+ current -= n;
145
+ length += n;
146
+ return *this;
147
+ ```
148
+