From Jason Turner

[range.nonprop.cache]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp1so0ktcw/{from.md → to.md} +59 -0
tmp/tmp1so0ktcw/{from.md → to.md} RENAMED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Non-propagating cache <a id="range.nonprop.cache">[[range.nonprop.cache]]</a>
2
+
3
+ Some types in subclause [[range.adaptors]] are specified in terms of an
4
+ exposition-only class template *`non-propagating-{}cache`*.
5
+ `non-propagating-cache<T>` behaves exactly like `optional<T>` with the
6
+ following differences:
7
+
8
+ - `non-propagating-cache<T>` constrains its type parameter `T` with
9
+ `is_object_v<T>`.
10
+ - The copy constructor is equivalent to:
11
+ ``` cpp
12
+ constexpr non-propagating-cache(const non-propagating-cache&) noexcept {}
13
+ ```
14
+ - The move constructor is equivalent to:
15
+ ``` cpp
16
+ constexpr non-propagating-cache(non-propagating-cache&& other) noexcept {
17
+ other.reset();
18
+ }
19
+ ```
20
+ - The copy assignment operator is equivalent to:
21
+ ``` cpp
22
+ constexpr non-propagating-cache& operator=(const non-propagating-cache& other) noexcept {
23
+ if (addressof(other) != this)
24
+ reset();
25
+ return *this;
26
+ }
27
+ ```
28
+ - The move assignment operator is equivalent to:
29
+ ``` cpp
30
+ constexpr non-propagating-cache& operator=(non-propagating-cache&& other) noexcept {
31
+ reset();
32
+ other.reset();
33
+ return *this;
34
+ }
35
+ ```
36
+ - `non-propagating-cache<T>` has an additional member function template
37
+ specified as follows:
38
+ ``` cpp
39
+ template<class I>
40
+ constexpr T& emplace-deref(const I& i); // exposition only
41
+ ```
42
+
43
+ *Mandates:* The declaration `T t(*i);` is well-formed for some
44
+ invented variable `t`.
45
+ \[*Note 1*: If `*i` is a prvalue of type cv `T`, there is no
46
+ requirement that it is movable [[dcl.init.general]]. — *end note*]
47
+ *Effects:* Calls `reset()`. Then direct-non-list-initializes the
48
+ contained value with `*i`.
49
+ *Ensures:* `*this` contains a value.
50
+ *Returns:* A reference to the new contained value.
51
+ *Throws:* Any exception thrown by the initialization of the contained
52
+ value.
53
+ *Remarks:* If an exception is thrown during the initialization of `T`,
54
+ `*this` does not contain a value, and the previous value (if any) has
55
+ been destroyed.
56
+
57
+ [*Note 1*: *`non-propagating-cache`* enables an input view to
58
+ temporarily cache values as it is iterated over. — *end note*]
59
+