std::expected<T,E>::value

If *this contains an expected value, returns a reference to the contained value. For the void partial specialization, the function returns normally when the object contains an expected value.

# Declarations

# Primary template

constexpr T& value() &;

(since C++23)

constexpr const T& value() const&;

(since C++23)

constexpr T&& value() &&;

(since C++23)

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

(since C++23)

# void partial specialization

constexpr void value() const&;

(since C++23)

constexpr void value() &&;

(since C++23)

# Defect reports

DRApplied toBehavior as publishedCorrect behavior
LWG 3940C++23E was not required to be copy/move-constructible for overloads (5,6)required

# See also