std::expected<T,E>::operator bool, std::expected<T,E>::has_value

Checks whether *this represents an expected value.

# Declarations

constexpr explicit operator bool() const noexcept;

(since C++23)

constexpr bool has_value() const noexcept;

(since C++23)

# Return value

has_val

# Notes

A std::expected object is never valueless. If has_value() returns true, operator*() can be used to access the expected value; otherwise, error() can be used to access the unexpected value.

# Example

This section is incompleteReason: no example

# See also