22 General utilities library [utilities]

22.5 Optional objects [optional]

22.5.4 Partial specialization of optional for reference types [optional.optional.ref]

22.5.4.6 Observers [optional.ref.observe]

constexpr T* operator->() const noexcept;
Hardened preconditions: has_value() is true.
Returns: val.
constexpr T& operator*() const noexcept;
Hardened preconditions: has_value() is true.
Returns: *val.
constexpr explicit operator bool() const noexcept;
Returns: val != nullptr.
constexpr bool has_value() const noexcept;
Returns: val != nullptr.
constexpr T& value() const;
Effects: Equivalent to: return has_value() ? *val : throw bad_optional_access();
template<class U = remove_cv_t<T>> constexpr remove_cv_t<T> value_or(U&& u) const;
Let X be remove_cv_t<T>.
Mandates: is_constructible_v<X, T&> && is_convertible_v<U, X> is true.
Effects: Equivalent to: return has_value() ? *val : static_cast<X>(std::forward<U>(u));