A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://en.cppreference.com/w/cpp/algorithm/../ranges/../utility/expected/value.html below:

std::expected<T,E>::value - cppreference.com

Primary template

constexpr T& value() &;

(1) (since C++23)

constexpr const T& value() const&;

(2) (since C++23)

constexpr T&& value() &&;

(3) (since C++23)

constexpr const T&& value() const&&;

(4) (since C++23)

void partial specialization

constexpr void value() const&;

(5) (since C++23)

constexpr void value() &&;

(6) (since C++23)

If *this contains an expected value, returns a reference to the contained value. Returns nothing for void partial specialization.

Otherwise, throws an exception of type std::bad_expected_access<std::decay_t<E>> that contains a copy of error().

[edit] Return value

3,4) std::move(val)

[edit] Exceptions [edit] Example [edit] Defect reports

The following behavior-changing defect reports were applied retroactively to previously published C++ standards.

DR Applied to Behavior as published Correct behavior LWG 3940 C++23 E was not required to be copy/move-constructible for overloads (5,6) required [edit] See also returns the expected value if present, another value otherwise
(public member function) [edit] accesses the expected value
(public member function) [edit] returns the unexpected value
(public member function) [edit] exception indicating checked access to an expected that contains an unexpected value
(class template) [edit]

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4