From Jason Turner

[common.iter.nav]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmprmkj66v7/{from.md → to.md} +39 -5
tmp/tmprmkj66v7/{from.md → to.md} RENAMED
@@ -1,28 +1,62 @@
1
  #### Navigation <a id="common.iter.nav">[[common.iter.nav]]</a>
2
 
3
  ``` cpp
4
- common_iterator& operator++();
5
  ```
6
 
7
- *Preconditions:* `holds_alternative<I>(v_)`.
8
 
9
  *Effects:* Equivalent to `++get<I>(v_)`.
10
 
11
  *Returns:* `*this`.
12
 
13
  ``` cpp
14
- decltype(auto) operator++(int);
15
  ```
16
 
17
- *Preconditions:* `holds_alternative<I>(v_)`.
18
 
19
  *Effects:* If `I` models `forward_iterator`, equivalent to:
20
 
21
  ``` cpp
22
  common_iterator tmp = *this;
23
  ++*this;
24
  return tmp;
25
  ```
26
 
27
- Otherwise, equivalent to: `return get<I>(v_)++;`
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
 
 
1
  #### Navigation <a id="common.iter.nav">[[common.iter.nav]]</a>
2
 
3
  ``` cpp
4
+ constexpr common_iterator& operator++();
5
  ```
6
 
7
+ *Preconditions:* `holds_alternative<I>(v_)` is `true`.
8
 
9
  *Effects:* Equivalent to `++get<I>(v_)`.
10
 
11
  *Returns:* `*this`.
12
 
13
  ``` cpp
14
+ constexpr decltype(auto) operator++(int);
15
  ```
16
 
17
+ *Preconditions:* `holds_alternative<I>(v_)` is `true`.
18
 
19
  *Effects:* If `I` models `forward_iterator`, equivalent to:
20
 
21
  ``` cpp
22
  common_iterator tmp = *this;
23
  ++*this;
24
  return tmp;
25
  ```
26
 
27
+ Otherwise, if `requires(I& i) { { *i++ } -> `*`can-reference`*`; }` is
28
+ `true` or
29
+
30
+ ``` cpp
31
+ indirectly_readable<I> && constructible_from<iter_value_t<I>, iter_reference_t<I>> &&
32
+ move_constructible<iter_value_t<I>>
33
+ ```
34
+
35
+ is `false`, equivalent to:
36
+
37
+ ``` cpp
38
+ return get<I>(v_)++;
39
+ ```
40
+
41
+ Otherwise, equivalent to:
42
+
43
+ ``` cpp
44
+ postfix-proxy p(**this);
45
+ ++*this;
46
+ return p;
47
+ ```
48
+
49
+ where *postfix-proxy* is the exposition-only class:
50
+
51
+ ``` cpp
52
+ class postfix-proxy {
53
+ iter_value_t<I> keep_;
54
+ constexpr postfix-proxy(iter_reference_t<I>&& x)
55
+ : keep_(std::forward<iter_reference_t<I>>(x)) {}
56
+ public:
57
+ constexpr const iter_value_t<I>& operator*() const noexcept {
58
+ return keep_;
59
+ }
60
+ };
61
+ ```
62