Skip to content

Commit 199ed18

Browse files
burblebeetkoeppe
authored andcommitted
LWG3973 Monadic operations should be ADL-proof
1 parent 4335e09 commit 199ed18

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

source/utilities.tex

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4153,7 +4153,7 @@
41534153

41544154
\begin{itemdescr}
41554155
\pnum
4156-
Let \tcode{U} be \tcode{invoke_result_t<F, decltype(value())>}.
4156+
Let \tcode{U} be \tcode{invoke_result_t<F, decltype(*val)>}.
41574157

41584158
\pnum
41594159
\mandates
@@ -4164,7 +4164,7 @@
41644164
Equivalent to:
41654165
\begin{codeblock}
41664166
if (*this) {
4167-
return invoke(std::forward<F>(f), value());
4167+
return invoke(std::forward<F>(f), *val);
41684168
} else {
41694169
return remove_cvref_t<U>();
41704170
}
@@ -4179,7 +4179,7 @@
41794179

41804180
\begin{itemdescr}
41814181
\pnum
4182-
Let \tcode{U} be \tcode{invoke_result_t<F, decltype(std::move(value()))>}.
4182+
Let \tcode{U} be \tcode{invoke_result_t<F, decltype(std::move(*val))>}.
41834183

41844184
\pnum
41854185
\mandates
@@ -4190,7 +4190,7 @@
41904190
Equivalent to:
41914191
\begin{codeblock}
41924192
if (*this) {
4193-
return invoke(std::forward<F>(f), std::move(value()));
4193+
return invoke(std::forward<F>(f), std::move(*val));
41944194
} else {
41954195
return remove_cvref_t<U>();
41964196
}
@@ -4205,15 +4205,15 @@
42054205

42064206
\begin{itemdescr}
42074207
\pnum
4208-
Let \tcode{U} be \tcode{remove_cv_t<invoke_result_t<F, decltype(value())>>}.
4208+
Let \tcode{U} be \tcode{remove_cv_t<invoke_result_t<F, decltype(*val)>>}.
42094209

42104210
\pnum
42114211
\mandates
42124212
\tcode{U} is a non-array object type
42134213
other than \tcode{in_place_t} or \tcode{nullopt_t}.
42144214
The declaration
42154215
\begin{codeblock}
4216-
U u(invoke(std::forward<F>(f), value()));
4216+
U u(invoke(std::forward<F>(f), *val));
42174217
\end{codeblock}
42184218
is well-formed for some invented variable \tcode{u}.
42194219
\begin{note}
@@ -4224,7 +4224,7 @@
42244224
\returns
42254225
If \tcode{*this} contains a value, an \tcode{optional<U>} object
42264226
whose contained value is direct-non-list-initialized with
4227-
\tcode{invoke(std::forward<F>(f), value())};
4227+
\tcode{invoke(std::forward<F>(f), *val)};
42284228
otherwise, \tcode{optional<U>()}.
42294229
\end{itemdescr}
42304230

@@ -4237,15 +4237,15 @@
42374237
\begin{itemdescr}
42384238
\pnum
42394239
Let \tcode{U} be
4240-
\tcode{remove_cv_t<invoke_result_t<F, decltype(std::move(value()))>>}.
4240+
\tcode{remove_cv_t<invoke_result_t<F, decltype(std::move(*val))>>}.
42414241

42424242
\pnum
42434243
\mandates
42444244
\tcode{U} is a non-array object type
42454245
other than \tcode{in_place_t} or \tcode{nullopt_t}.
42464246
The declaration
42474247
\begin{codeblock}
4248-
U u(invoke(std::forward<F>(f), std::move(value())));
4248+
U u(invoke(std::forward<F>(f), std::move(*val)));
42494249
\end{codeblock}
42504250
is well-formed for some invented variable \tcode{u}.
42514251
\begin{note}
@@ -4256,7 +4256,7 @@
42564256
\returns
42574257
If \tcode{*this} contains a value, an \tcode{optional<U>} object
42584258
whose contained value is direct-non-list-initialized with
4259-
\tcode{invoke(std::forward<F>(f), std::move(value()))};
4259+
\tcode{invoke(std::forward<F>(f), std::move(*val))};
42604260
otherwise, \tcode{optional<U>()}.
42614261
\end{itemdescr}
42624262

@@ -8368,7 +8368,7 @@
83688368

83698369
\begin{itemdescr}
83708370
\pnum
8371-
Let \tcode{U} be \tcode{remove_cvref_t<invoke_result_t<F, decltype(**this)>>}.
8371+
Let \tcode{U} be \tcode{remove_cvref_t<invoke_result_t<F, decltype((\exposid{val}))>>}.
83728372

83738373
\pnum
83748374
\constraints
@@ -8384,7 +8384,7 @@
83848384
Equivalent to:
83858385
\begin{codeblock}
83868386
if (has_value())
8387-
return invoke(std::forward<F>(f), **this);
8387+
return invoke(std::forward<F>(f), @\exposid{val}@);
83888388
else
83898389
return U(unexpect, error());
83908390
\end{codeblock}
@@ -8399,7 +8399,7 @@
83998399
\begin{itemdescr}
84008400
\pnum
84018401
Let \tcode{U} be
8402-
\tcode{remove_cvref_t<invoke_result_t<F, decltype(std::move(**this))>>}.
8402+
\tcode{remove_cvref_t<invoke_result_t<F, decltype(std::move(\exposid{val}))>>}.
84038403

84048404
\pnum
84058405
\constraints
@@ -8415,7 +8415,7 @@
84158415
Equivalent to:
84168416
\begin{codeblock}
84178417
if (has_value())
8418-
return invoke(std::forward<F>(f), std::move(**this));
8418+
return invoke(std::forward<F>(f), std::move(@\exposid{val}@));
84198419
else
84208420
return U(unexpect, std::move(error()));
84218421
\end{codeblock}
@@ -8433,7 +8433,7 @@
84338433

84348434
\pnum
84358435
\constraints
8436-
\tcode{is_constructible_v<T, decltype(**this)>} is \tcode{true}.
8436+
\tcode{is_constructible_v<T, decltype((\exposid{val}))>} is \tcode{true}.
84378437

84388438
\pnum
84398439
\mandates
@@ -8445,7 +8445,7 @@
84458445
Equivalent to:
84468446
\begin{codeblock}
84478447
if (has_value())
8448-
return G(in_place, **this);
8448+
return G(in_place, @\exposid{val}@);
84498449
else
84508450
return invoke(std::forward<F>(f), error());
84518451
\end{codeblock}
@@ -8464,7 +8464,7 @@
84648464

84658465
\pnum
84668466
\constraints
8467-
\tcode{is_constructible_v<T, decltype(std::move(**this))>} is \tcode{true}.
8467+
\tcode{is_constructible_v<T, decltype(std::move(\exposid{val}))>} is \tcode{true}.
84688468

84698469
\pnum
84708470
\mandates
@@ -8476,7 +8476,7 @@
84768476
Equivalent to:
84778477
\begin{codeblock}
84788478
if (has_value())
8479-
return G(in_place, std::move(**this));
8479+
return G(in_place, std::move(@\exposid{val}@));
84808480
else
84818481
return invoke(std::forward<F>(f), std::move(error()));
84828482
\end{codeblock}
@@ -8491,7 +8491,7 @@
84918491
\begin{itemdescr}
84928492
\pnum
84938493
Let \tcode{U} be
8494-
\tcode{remove_cv_t<invoke_result_t<F, decltype(**this)>>}.
8494+
\tcode{remove_cv_t<invoke_result_t<F, decltype((\exposid{val}))>>}.
84958495

84968496
\pnum
84978497
\constraints
@@ -8503,7 +8503,7 @@
85038503
If \tcode{is_void_v<U>} is \tcode{false},
85048504
the declaration
85058505
\begin{codeblock}
8506-
U u(invoke(std::forward<F>(f), **this));
8506+
U u(invoke(std::forward<F>(f), @\exposid{val}@));
85078507
\end{codeblock}
85088508
is well-formed.
85098509

@@ -8517,9 +8517,9 @@
85178517
Otherwise, if \tcode{is_void_v<U>} is \tcode{false}, returns an
85188518
\tcode{expected<U, E>} object whose \exposid{has_val} member is \tcode{true}
85198519
and \exposid{val} member is direct-non-list-initialized with
8520-
\tcode{invoke(std::forward<F>(f), **this)}.
8520+
\tcode{invoke(std::forward<F>(f), \exposid{val})}.
85218521
\item
8522-
Otherwise, evaluates \tcode{invoke(std::forward<F>(f), **this)} and then
8522+
Otherwise, evaluates \tcode{invoke(std::forward<F>(f), \exposid{val})} and then
85238523
returns \tcode{expected<U, E>()}.
85248524
\end{itemize}
85258525
\end{itemdescr}
@@ -8533,7 +8533,7 @@
85338533
\begin{itemdescr}
85348534
\pnum
85358535
Let \tcode{U} be
8536-
\tcode{remove_cv_t<invoke_result_t<F, decltype(std::move(**this))>>}.
8536+
\tcode{remove_cv_t<invoke_result_t<F, decltype(std::move(\exposid{val}))>>}.
85378537

85388538
\pnum
85398539
\constraints
@@ -8544,7 +8544,7 @@
85448544
\tcode{U} is a valid value type for \tcode{expected}. If \tcode{is_void_v<U>} is
85458545
\tcode{false}, the declaration
85468546
\begin{codeblock}
8547-
U u(invoke(std::forward<F>(f), std::move(**this)));
8547+
U u(invoke(std::forward<F>(f), std::move(@\exposid{val}@)));
85488548
\end{codeblock}
85498549
is well-formed.
85508550

@@ -8558,9 +8558,9 @@
85588558
Otherwise, if \tcode{is_void_v<U>} is \tcode{false}, returns an
85598559
\tcode{expected<U, E>} object whose \exposid{has_val} member is \tcode{true}
85608560
and \exposid{val} member is direct-non-list-initialized with
8561-
\tcode{invoke(std::forward<F>(f), std::move(**this))}.
8561+
\tcode{invoke(std::forward<F>(f), std::move(\exposid{val}))}.
85628562
\item
8563-
Otherwise, evaluates \tcode{invoke(std::forward<F>(f), std::move(**this))} and
8563+
Otherwise, evaluates \tcode{invoke(std::forward<F>(f), std::move(\exposid{val}))} and
85648564
then returns \tcode{ex\-pected<U, E>()}.
85658565
\end{itemize}
85668566
\end{itemdescr}
@@ -8577,7 +8577,7 @@
85778577

85788578
\pnum
85798579
\constraints
8580-
\tcode{is_constructible_v<T, decltype(**this)>} is \tcode{true}.
8580+
\tcode{is_constructible_v<T, decltype((\exposid{val}))>} is \tcode{true}.
85818581

85828582
\pnum
85838583
\mandates
@@ -8591,7 +8591,7 @@
85918591
\pnum
85928592
\returns
85938593
If \tcode{has_value()} is \tcode{true},
8594-
\tcode{expected<T, G>(in_place, **this)}; otherwise, an \tcode{expected<T, G>}
8594+
\tcode{expected<T, G>(in_place, \exposid{val})}; otherwise, an \tcode{expected<T, G>}
85958595
object whose \exposid{has_val} member is \tcode{false} and \exposid{unex} member
85968596
is direct-non-list-initialized with \tcode{invoke(std::forward<F>(f), error())}.
85978597
\end{itemdescr}
@@ -8609,7 +8609,7 @@
86098609

86108610
\pnum
86118611
\constraints
8612-
\tcode{is_constructible_v<T, decltype(std::move(**this))>} is \tcode{true}.
8612+
\tcode{is_constructible_v<T, decltype(std::move(\exposid{val}))>} is \tcode{true}.
86138613

86148614
\pnum
86158615
\mandates
@@ -8623,7 +8623,7 @@
86238623
\pnum
86248624
\returns
86258625
If \tcode{has_value()} is \tcode{true},
8626-
\tcode{expected<T, G>(in_place, std::move(**this))}; otherwise, an
8626+
\tcode{expected<T, G>(in_place, std::move(\exposid{val}))}; otherwise, an
86278627
\tcode{expected<T, G>} object whose \exposid{has_val} member is \tcode{false}
86288628
and \exposid{unex} member is direct-non-list-initialized with
86298629
\tcode{invoke(std::forward<F>(f), std::move(error()))}.

0 commit comments

Comments
 (0)