This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of WP status.
value()
instead of has_value()
Section: 22.8.6.5 [expected.object.swap], 22.8.7.5 [expected.void.swap] Status: WP Submitter: Ben Craig Opened: 2023-06-25 Last modified: 2023-11-22
Priority: Not Prioritized
View all issues with WP status.
Discussion:
22.8.6.5 [expected.object.swap] p2 has the following text in it:
For the case where
rhs.value()
isfalse
andthis->has_value()
istrue
, equivalent to: […]
The table preceding that text is a table of this->has_value()
vs. rhs.has_value()
. The rhs.value()
in the text is almost certainly a typo, as a .value()
call here doesn't make any sense, especially if this is an
expected<non-bool, E>
.
[2023-10-27; Reflector poll]
Set status to Tentatively Ready after seven votes in favour during reflector poll.
[2023-11-11 Approved at November 2023 meeting in Kona. Status changed: Voting → WP.]
Proposed resolution:
This wording is relative to N4950.
Modify 22.8.6.5 [expected.object.swap] as indicated:
constexpr void swap(expected& rhs) noexcept(see below);-1- […]
-2- Effects: See Table 63 [tab:expected.object.swap]. For the case whererhs.has_value()
isfalse
andthis->has_value()
istrue
, equivalent to: […]
Modify 22.8.7.5 [expected.void.swap] as indicated:
constexpr void swap(expected& rhs) noexcept(see below);-1- […]
-2- Effects: See Table 64 [tab:expected.void.swap]. For the case whererhs.has_value()
isfalse
andthis->has_value()
istrue
, equivalent to: […]