Namespaces
Variants
Views
Actions

std::optional::value

From cppreference.com
constexpr const T& value() const;
(since C++14)
T& value();
(since C++14)

Returns the contained value.

Contents

[edit] Parameters

(none)

[edit] Return value

A reference to the contained value.

[edit] Exceptions

std::bad_optional_access if *this is in disengaged state.

[edit] See also

returns the contained value if engaged, another value otherwise
(public member function) [edit]