From Jason Turner

[common.iter.access]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp_njb2545/{from.md → to.md} +53 -0
tmp/tmp_njb2545/{from.md → to.md} RENAMED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Accessors <a id="common.iter.access">[[common.iter.access]]</a>
2
+
3
+ ``` cpp
4
+ decltype(auto) operator*();
5
+ decltype(auto) operator*() const
6
+ requires dereferenceable<const I>;
7
+ ```
8
+
9
+ *Preconditions:* `holds_alternative<I>(v_)`.
10
+
11
+ *Effects:* Equivalent to: `return *get<I>(v_);`
12
+
13
+ ``` cpp
14
+ decltype(auto) operator->() const
15
+ requires see below;
16
+ ```
17
+
18
+ The expression in the requires clause is equivalent to:
19
+
20
+ ``` cpp
21
+ indirectly_readable<const I> &&
22
+ (requires(const I& i) { i.operator->(); } ||
23
+ is_reference_v<iter_reference_t<I>> ||
24
+ constructible_from<iter_value_t<I>, iter_reference_t<I>>)
25
+ ```
26
+
27
+ *Preconditions:* `holds_alternative<I>(v_)`.
28
+
29
+ *Effects:*
30
+
31
+ - If `I` is a pointer type or if the expression
32
+ `get<I>(v_).operator->()` is well-formed, equivalent to:
33
+ `return get<I>(v_);`
34
+ - Otherwise, if `iter_reference_t<I>` is a reference type, equivalent
35
+ to:
36
+ ``` cpp
37
+ auto&& tmp = *get<I>(v_);
38
+ return addressof(tmp);
39
+ ```
40
+ - Otherwise, equivalent to: `return `*`proxy`*`(*get<I>(v_));` where
41
+ *proxy* is the exposition-only class:
42
+ ``` cpp
43
+ class proxy {
44
+ iter_value_t<I> keep_;
45
+ proxy(iter_reference_t<I>&& x)
46
+ : keep_(std::move(x)) {}
47
+ public:
48
+ const iter_value_t<I>* operator->() const {
49
+ return addressof(keep_);
50
+ }
51
+ };
52
+ ```
53
+