跳转至

cf::bad_expected_access

Exception thrown when accessing the value of an expected that contains an error. More...

#include <expected.hpp>

Public Functions

Name
bad_expected_access(E e)
Constructs the exception with an error value.
constE & error() const
Returns a const reference to the stored error.
E & error()
Returns a reference to the stored error.
constE && error() const
Returns a const rvalue reference to the stored error.
E && error()
Returns an rvalue reference to the stored error.

Detailed Description

template <typenameE >
class cf::bad_expected_access;

Exception thrown when accessing the value of an expected that contains an error.

Template Parameters:

  • E Error type stored in the expected.

Exception thrown when accessing the value of an expected in error state.

Public Functions Documentation

function bad_expected_access

inline explicit bad_expected_access(
    E e
)

Constructs the exception with an error value.

Parameters:

  • e Error value to store.

function error

inline constE & error() const

Returns a const reference to the stored error.

Exceptions:

  • None.

Return: Const reference to the error.

function error

inline E & error()

Returns a reference to the stored error.

Exceptions:

  • None.

Return: Reference to the error.

function error

inline constE && error() const

Returns a const rvalue reference to the stored error.

Exceptions:

  • None.

Return: Const rvalue reference to the error.

function error

inline E && error()

Returns an rvalue reference to the stored error.

Exceptions:

  • None.

Return: Rvalue reference to the error.


Updated on 2026-03-09 at 10:14:00 +0000