##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::experimental::optional::value

From cppreference.com
< cpp‎ | experimental‎ | optional

constexpr const T& value() const; |  | (library fundamentals TS)
T& value(); |  | (library fundamentals TS)

Returns the contained value.

### [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

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

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/experimental/optional/value&oldid=68166"