Skip to content

Commit 5fc53ce

Browse files
authored
Merge 2022-07 LWG Motion 36
P2549R1 std::unexpected<E> should have error() as member accessor
2 parents 3439a34 + a3c3c01 commit 5fc53ce

File tree

1 file changed

+36
-36
lines changed

1 file changed

+36
-36
lines changed

source/utilities.tex

+36-36
Original file line numberDiff line numberDiff line change
@@ -6929,10 +6929,10 @@
69296929
constexpr unexpected& operator=(const unexpected&) = default;
69306930
constexpr unexpected& operator=(unexpected&&) = default;
69316931

6932-
constexpr const E& value() const & noexcept;
6933-
constexpr E& value() & noexcept;
6934-
constexpr const E&& value() const && noexcept;
6935-
constexpr E&& value() && noexcept;
6932+
constexpr const E& error() const & noexcept;
6933+
constexpr E& error() & noexcept;
6934+
constexpr const E&& error() const && noexcept;
6935+
constexpr E&& error() && noexcept;
69366936

69376937
constexpr void swap(unexpected& other) noexcept(@\seebelow@);
69386938

@@ -6942,7 +6942,7 @@
69426942
friend constexpr void swap(unexpected& x, unexpected& y) noexcept(noexcept(x.swap(y)));
69436943

69446944
private:
6945-
E @\exposid{val}@; // \expos
6945+
E @\exposidnc{unex}@; // \expos
69466946
};
69476947

69486948
template<class E> unexpected(E) -> unexpected<E>;
@@ -6979,11 +6979,11 @@
69796979

69806980
\pnum
69816981
\effects
6982-
Direct-non-list-initializes \exposid{val} with \tcode{std::forward<Err>(e)}.
6982+
Direct-non-list-initializes \exposid{unex} with \tcode{std::forward<Err>(e)}.
69836983

69846984
\pnum
69856985
\throws
6986-
Any exception thrown by the initialization of \exposid{val}.
6986+
Any exception thrown by the initialization of \exposid{unex}.
69876987
\end{itemdescr}
69886988

69896989
\indexlibraryctor{unexpected}%
@@ -7000,11 +7000,11 @@
70007000
\pnum
70017001
\effects
70027002
Direct-non-list-initializes
7003-
\exposid{val} with \tcode{std::forward<Args>(args)...}.
7003+
\exposid{unex} with \tcode{std::forward<Args>(args)...}.
70047004

70057005
\pnum
70067006
\throws
7007-
Any exception thrown by the initialization of \exposid{val}.
7007+
Any exception thrown by the initialization of \exposid{unex}.
70087008
\end{itemdescr}
70097009

70107010
\indexlibraryctor{unexpected}%
@@ -7021,37 +7021,37 @@
70217021
\pnum
70227022
\effects
70237023
Direct-non-list-initializes
7024-
\exposid{val} with \tcode{il, std::forward<Args>(args)...}.
7024+
\exposid{unex} with \tcode{il, std::forward<Args>(args)...}.
70257025

70267026
\pnum
70277027
\throws
7028-
Any exception thrown by the initialization of \exposid{val}.
7028+
Any exception thrown by the initialization of \exposid{unex}.
70297029
\end{itemdescr}
70307030

70317031
\rSec3[expected.un.obs]{Observers}
70327032

7033-
\indexlibrarymember{value}{unexpected}%
7033+
\indexlibrarymember{error}{unexpected}%
70347034
\begin{itemdecl}
7035-
constexpr const E& value() const & noexcept;
7036-
constexpr E& value() & noexcept;
7035+
constexpr const E& error() const & noexcept;
7036+
constexpr E& error() & noexcept;
70377037
\end{itemdecl}
70387038

70397039
\begin{itemdescr}
70407040
\pnum
70417041
\returns
7042-
\exposid{val}.
7042+
\exposid{unex}.
70437043
\end{itemdescr}
70447044

7045-
\indexlibrarymember{value}{unexpected}%
7045+
\indexlibrarymember{error}{unexpected}%
70467046
\begin{itemdecl}
7047-
constexpr E&& value() && noexcept;
7048-
constexpr const E&& value() const && noexcept;
7047+
constexpr E&& error() && noexcept;
7048+
constexpr const E&& error() const && noexcept;
70497049
\end{itemdecl}
70507050

70517051
\begin{itemdescr}
70527052
\pnum
70537053
\returns
7054-
\tcode{std::move(\exposid{val})}.
7054+
\tcode{std::move(\exposid{unex})}.
70557055
\end{itemdescr}
70567056

70577057
\rSec3[expected.un.swap]{Swap}
@@ -7069,7 +7069,7 @@
70697069
\pnum
70707070
\effects
70717071
Equivalent to:
7072-
\tcode{using std::swap; swap(\exposid{val}, other.\exposid{val});}
7072+
\tcode{using std::swap; swap(\exposid{unex}, other.\exposid{unex});}
70737073
\end{itemdescr}
70747074

70757075
\begin{itemdecl}
@@ -7097,12 +7097,12 @@
70977097
\begin{itemdescr}
70987098
\pnum
70997099
\mandates
7100-
The expression \tcode{x.value() == y.value()} is well-formed and
7100+
The expression \tcode{x.error() == y.error()} is well-formed and
71017101
its result is convertible to \tcode{bool}.
71027102

71037103
\pnum
71047104
\returns
7105-
\tcode{x.value() == y.value()}.
7105+
\tcode{x.error() == y.error()}.
71067106
\end{itemdescr}
71077107

71087108
\rSec2[expected.bad]{Class template \tcode{bad_expected_access}}
@@ -7120,7 +7120,7 @@
71207120
E&& error() && noexcept;
71217121
const E&& error() const && noexcept;
71227122
private:
7123-
E @\exposid{val}@; // \expos
7123+
E @\exposidnc{unex}@; // \expos
71247124
};
71257125
}
71267126
\end{codeblock}
@@ -7139,7 +7139,7 @@
71397139
\begin{itemdescr}
71407140
\pnum
71417141
\effects
7142-
Initializes \exposid{val} with \tcode{std::move(e)}.
7142+
Initializes \exposid{unex} with \tcode{std::move(e)}.
71437143
\end{itemdescr}
71447144

71457145
\indexlibrarymember{error}{bad_expected_access}%
@@ -7151,7 +7151,7 @@
71517151
\begin{itemdescr}
71527152
\pnum
71537153
\returns
7154-
\exposid{val}.
7154+
\exposid{unex}.
71557155
\end{itemdescr}
71567156

71577157
\indexlibrarymember{error}{bad_expected_access}%
@@ -7163,7 +7163,7 @@
71637163
\begin{itemdescr}
71647164
\pnum
71657165
\returns
7166-
\tcode{std::move(\exposid{val})}.
7166+
\tcode{std::move(\exposid{unex})}.
71677167
\end{itemdescr}
71687168

71697169
\indexlibrarymember{what}{bad_expected_access}%
@@ -7575,7 +7575,7 @@
75757575

75767576
\pnum
75777577
\effects
7578-
Direct-non-list-initializes \exposid{unex} with \tcode{std::forward<GF>(e.value())}.
7578+
Direct-non-list-initializes \exposid{unex} with \tcode{std::forward<GF>(e.error())}.
75797579

75807580
\pnum
75817581
\ensures
@@ -7905,12 +7905,12 @@
79057905
\item
79067906
If \tcode{has_value()} is \tcode{true}, equivalent to:
79077907
\begin{codeblock}
7908-
@\exposid{reinit-expected}@(@\exposid{unex}@, @\exposid{val}@, std::forward<GF>(e.value()));
7908+
@\exposid{reinit-expected}@(@\exposid{unex}@, @\exposid{val}@, std::forward<GF>(e.error()));
79097909
@\exposid{has_val}@ = false;
79107910
\end{codeblock}
79117911
\item
79127912
Otherwise, equivalent to:
7913-
\tcode{\exposid{unex} = std::forward<GF>(e.value());}
7913+
\tcode{\exposid{unex} = std::forward<GF>(e.error());}
79147914
\end{itemize}
79157915

79167916
\pnum
@@ -8270,12 +8270,12 @@
82708270
\begin{itemdescr}
82718271
\pnum
82728272
\mandates
8273-
The expression \tcode{x.error() == e.value()} is well-formed and
8273+
The expression \tcode{x.error() == e.error()} is well-formed and
82748274
its result is convertible to \tcode{bool}.
82758275

82768276
\pnum
82778277
\returns
8278-
\tcode{!x.has_value() \&\& static_cast<bool>(x.error() == e.value())}.
8278+
\tcode{!x.has_value() \&\& static_cast<bool>(x.error() == e.error())}.
82798279
\end{itemdescr}
82808280

82818281
\rSec2[expected.void]{Partial specialization of \tcode{expected} for \tcode{void} types}
@@ -8516,7 +8516,7 @@
85168516
\pnum
85178517
\effects
85188518
Direct-non-list-initializes \exposid{unex}
8519-
with \tcode{std::forward<GF>(e.value())}.
8519+
with \tcode{std::forward<GF>(e.error())}.
85208520

85218521
\pnum
85228522
\ensures
@@ -8703,12 +8703,12 @@
87038703
\item
87048704
If \tcode{has_value()} is \tcode{true}, equivalent to:
87058705
\begin{codeblock}
8706-
construct_at(addressof(@\exposid{unex}@), std::forward<GF>(e.value()));
8706+
construct_at(addressof(@\exposid{unex}@), std::forward<GF>(e.error()));
87078707
@\exposid{has_val}@ = false;
87088708
\end{codeblock}
87098709
\item
87108710
Otherwise, equivalent to:
8711-
\tcode{\exposid{unex} = std::forward<GF>(e.value());}
8711+
\tcode{\exposid{unex} = std::forward<GF>(e.error());}
87128712
\end{itemize}
87138713

87148714
\pnum
@@ -8897,12 +8897,12 @@
88978897
\begin{itemdescr}
88988898
\pnum
88998899
\mandates
8900-
The expression \tcode{x.error() == e.value()} is well-formed and
8900+
The expression \tcode{x.error() == e.error()} is well-formed and
89018901
its result is convertible to \tcode{bool}.
89028902

89038903
\pnum
89048904
\returns
8905-
\tcode{!x.has_value() \&\& static_cast<bool>(x.error() == e.value())}.
8905+
\tcode{!x.has_value() \&\& static_cast<bool>(x.error() == e.error())}.
89068906
\end{itemdescr}
89078907

89088908
\rSec1[bitset]{Bitsets}

0 commit comments

Comments
 (0)