Namespaces
Variants
Views
Actions

std::optional::operator->, std::optional::operator*

From cppreference.com
constexpr const T* operator->() const;
(1) (since C++14)
T* operator->();
(1) (since C++14)
constexpr const T& operator*() const;
(2) (since C++14)
T& operator*();
(2) (since C++14)

Accesses the contained value.

1) Returns a pointer to the contained value.
2) Returns a reference to the contained value.

The behavior is undefined if *this is in disengaged state.

[edit] Parameters

(none)

[edit] Return value

Pointer or reference to the contained value.

[edit] Exceptions

(none)