Skip to content

Commit

Permalink
[optional.monadic] Replace value() with **this
Browse files Browse the repository at this point in the history
  • Loading branch information
jensmaurer committed Nov 16, 2023
1 parent b4166d9 commit f4a2ec3
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions source/utilities.tex
Original file line number Diff line number Diff line change
Expand Up @@ -4154,7 +4154,7 @@

\begin{itemdescr}
\pnum
Let \tcode{U} be \tcode{invoke_result_t<F, decltype(value())>}.
Let \tcode{U} be \tcode{invoke_result_t<F, decltype(**this)>}.

\pnum
\mandates
Expand All @@ -4165,7 +4165,7 @@
Equivalent to:
\begin{codeblock}
if (*this) {
return invoke(std::forward<F>(f), value());
return invoke(std::forward<F>(f), **this);
} else {
return remove_cvref_t<U>();
}
Expand All @@ -4180,7 +4180,7 @@

\begin{itemdescr}
\pnum
Let \tcode{U} be \tcode{invoke_result_t<F, decltype(std::move(value()))>}.
Let \tcode{U} be \tcode{invoke_result_t<F, decltype(std::move(**this))>}.

\pnum
\mandates
Expand All @@ -4191,7 +4191,7 @@
Equivalent to:
\begin{codeblock}
if (*this) {
return invoke(std::forward<F>(f), std::move(value()));
return invoke(std::forward<F>(f), std::move(**this));
} else {
return remove_cvref_t<U>();
}
Expand All @@ -4206,15 +4206,15 @@

\begin{itemdescr}
\pnum
Let \tcode{U} be \tcode{remove_cv_t<invoke_result_t<F, decltype(value())>>}.
Let \tcode{U} be \tcode{remove_cv_t<invoke_result_t<F, decltype(**this)>>}.

\pnum
\mandates
\tcode{U} is a non-array object type
other than \tcode{in_place_t} or \tcode{nullopt_t}.
The declaration
\begin{codeblock}
U u(invoke(std::forward<F>(f), value()));
U u(invoke(std::forward<F>(f), **this));
\end{codeblock}
is well-formed for some invented variable \tcode{u}.
\begin{note}
Expand All @@ -4225,7 +4225,7 @@
\returns
If \tcode{*this} contains a value, an \tcode{optional<U>} object
whose contained value is direct-non-list-initialized with
\tcode{invoke(std::forward<F>(f), value())};
\tcode{invoke(std::forward<F>(f), **this)};
otherwise, \tcode{optional<U>()}.
\end{itemdescr}

Expand All @@ -4238,15 +4238,15 @@
\begin{itemdescr}
\pnum
Let \tcode{U} be
\tcode{remove_cv_t<invoke_result_t<F, decltype(std::move(value()))>>}.
\tcode{remove_cv_t<invoke_result_t<F, decltype(std::move(**this))>>}.

\pnum
\mandates
\tcode{U} is a non-array object type
other than \tcode{in_place_t} or \tcode{nullopt_t}.
The declaration
\begin{codeblock}
U u(invoke(std::forward<F>(f), std::move(value())));
U u(invoke(std::forward<F>(f), std::move(**this)));
\end{codeblock}
is well-formed for some invented variable \tcode{u}.
\begin{note}
Expand All @@ -4257,7 +4257,7 @@
\returns
If \tcode{*this} contains a value, an \tcode{optional<U>} object
whose contained value is direct-non-list-initialized with
\tcode{invoke(std::forward<F>(f), std::move(value()))};
\tcode{invoke(std::forward<F>(f), std::move(**this))};
otherwise, \tcode{optional<U>()}.
\end{itemdescr}

Expand Down

0 comments on commit f4a2ec3

Please sign in to comment.