From Jason Turner

[refwrap]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp299rkum8/{from.md → to.md} +72 -1
tmp/tmp299rkum8/{from.md → to.md} RENAMED
@@ -23,10 +23,19 @@ namespace std {
23
 
24
  // [refwrap.invoke], invocation
25
  template<class... ArgTypes>
26
  constexpr invoke_result_t<T&, ArgTypes...> operator()(ArgTypes&&...) const
27
  noexcept(is_nothrow_invocable_v<T&, ArgTypes...>);
 
 
 
 
 
 
 
 
 
28
  };
29
 
30
  template<class T>
31
  reference_wrapper(T&) -> reference_wrapper<T>;
32
  }
@@ -40,10 +49,15 @@ function of type `T`.
40
  [[term.trivially.copyable.type]].
41
 
42
  The template parameter `T` of `reference_wrapper` may be an incomplete
43
  type.
44
 
 
 
 
 
 
45
  #### Constructors <a id="refwrap.const">[[refwrap.const]]</a>
46
 
47
  ``` cpp
48
  template<class U>
49
  constexpr reference_wrapper(U&& u) noexcept(see below);
@@ -104,11 +118,68 @@ template<class... ArgTypes>
104
  ```
105
 
106
  *Mandates:* `T` is a complete type.
107
 
108
  *Returns:* *INVOKE*(get(),
109
- std::forward\<ArgTypes\>(args)...). [[func.require]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
 
111
  #### Helper functions <a id="refwrap.helpers">[[refwrap.helpers]]</a>
112
 
113
  The template parameter `T` of the following `ref` and `cref` function
114
  templates may be an incomplete type.
 
23
 
24
  // [refwrap.invoke], invocation
25
  template<class... ArgTypes>
26
  constexpr invoke_result_t<T&, ArgTypes...> operator()(ArgTypes&&...) const
27
  noexcept(is_nothrow_invocable_v<T&, ArgTypes...>);
28
+
29
+ // [refwrap.comparisons], comparisons
30
+ friend constexpr bool operator==(reference_wrapper, reference_wrapper);
31
+ friend constexpr bool operator==(reference_wrapper, const T&);
32
+ friend constexpr bool operator==(reference_wrapper, reference_wrapper<const T>);
33
+
34
+ friend constexpr auto operator<=>(reference_wrapper, reference_wrapper);
35
+ friend constexpr auto operator<=>(reference_wrapper, const T&);
36
+ friend constexpr auto operator<=>(reference_wrapper, reference_wrapper<const T>);
37
  };
38
 
39
  template<class T>
40
  reference_wrapper(T&) -> reference_wrapper<T>;
41
  }
 
49
  [[term.trivially.copyable.type]].
50
 
51
  The template parameter `T` of `reference_wrapper` may be an incomplete
52
  type.
53
 
54
+ [*Note 1*: Using the comparison operators described in
55
+ [[refwrap.comparisons]] with `T` being an incomplete type can lead to an
56
+ ill-formed program with no diagnostic required
57
+ [[temp.point]], [[temp.constr.atomic]]. — *end note*]
58
+
59
  #### Constructors <a id="refwrap.const">[[refwrap.const]]</a>
60
 
61
  ``` cpp
62
  template<class U>
63
  constexpr reference_wrapper(U&& u) noexcept(see below);
 
118
  ```
119
 
120
  *Mandates:* `T` is a complete type.
121
 
122
  *Returns:* *INVOKE*(get(),
123
+ std::forward\<ArgTypes\>(args)...) [[func.require]].
124
+
125
+ #### Comparisons <a id="refwrap.comparisons">[[refwrap.comparisons]]</a>
126
+
127
+ ``` cpp
128
+ friend constexpr bool operator==(reference_wrapper x, reference_wrapper y);
129
+ ```
130
+
131
+ *Constraints:* The expression `x.get() == y.get()` is well-formed and
132
+ its result is convertible to `bool`.
133
+
134
+ *Returns:* `x.get() == y.get()`.
135
+
136
+ ``` cpp
137
+ friend constexpr bool operator==(reference_wrapper x, const T& y);
138
+ ```
139
+
140
+ *Constraints:* The expression `x.get() == y` is well-formed and its
141
+ result is convertible to `bool`.
142
+
143
+ *Returns:* `x.get() == y`.
144
+
145
+ ``` cpp
146
+ friend constexpr bool operator==(reference_wrapper x, reference_wrapper<const T> y);
147
+ ```
148
+
149
+ *Constraints:* `is_const_v<T>` is `false` and the expression
150
+ `x.get() == y.get()` is well-formed and its result is convertible to
151
+ `bool`.
152
+
153
+ *Returns:* `x.get() == y.get()`.
154
+
155
+ ``` cpp
156
+ friend constexpr auto operator<=>(reference_wrapper x, reference_wrapper y);
157
+ ```
158
+
159
+ *Constraints:* The expression *`synth-three-way`*`(x.get(), y.get())` is
160
+ well-formed.
161
+
162
+ *Returns:* *`synth-three-way`*`(x.get(), y.get())`.
163
+
164
+ ``` cpp
165
+ friend constexpr auto operator<=>(reference_wrapper x, const T& y);
166
+ ```
167
+
168
+ *Constraints:* The expression *`synth-three-way`*`(x.get(), y)` is
169
+ well-formed.
170
+
171
+ *Returns:* *`synth-three-way`*`(x.get(), y)`.
172
+
173
+ ``` cpp
174
+ friend constexpr auto operator<=>(reference_wrapper x, reference_wrapper<const T> y);
175
+ ```
176
+
177
+ *Constraints:* `is_const_v<T>` is `false`. The expression
178
+ *`synth-three-way`*`(x.get(), y.get())` is well-formed.
179
+
180
+ *Returns:* *`synth-three-way`*`(x.get(), y.get())`.
181
 
182
  #### Helper functions <a id="refwrap.helpers">[[refwrap.helpers]]</a>
183
 
184
  The template parameter `T` of the following `ref` and `cref` function
185
  templates may be an incomplete type.