Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::bad_expected_access< E > Class Template Reference

Exception thrown by expected::value() when no value is held. More...

#include <ah-cpp-compat.H>

Inheritance diagram for Aleph::bad_expected_access< E >:
[legend]
Collaboration diagram for Aleph::bad_expected_access< E >:
[legend]

Public Member Functions

 bad_expected_access (E e)
 Construct with an error value.
 
const char * what () const noexcept override
 Get exception description.
 
const E & error () const &noexcept
 Access the stored error (const lvalue).
 
E & error () &noexcept
 Access the stored error (lvalue).
 

Private Attributes

E err_
 

Detailed Description

template<class E>
class Aleph::bad_expected_access< E >

Exception thrown by expected::value() when no value is held.

Thrown when calling value() on an expected in the error state. Carries a copy of the stored error for inspection.

Template Parameters
EError type (must be movable).
Thread Safety
Exception objects may be copied across threads; what() and error() are safe to call concurrently on the same object.

Definition at line 242 of file ah-cpp-compat.H.

Constructor & Destructor Documentation

◆ bad_expected_access()

template<class E >
Aleph::bad_expected_access< E >::bad_expected_access ( E  e)
inlineexplicit

Construct with an error value.

Parameters
eThe error to store in the exception.
Exceptions
Anyexception thrown by E's move constructor.

Definition at line 251 of file ah-cpp-compat.H.

Member Function Documentation

◆ error() [1/2]

template<class E >
E & Aleph::bad_expected_access< E >::error ( ) &
inlinenoexcept

Access the stored error (lvalue).

Returns
Mutable reference to the error.
Complexity O(1). Does not throw.

Definition at line 272 of file ah-cpp-compat.H.

References Aleph::bad_expected_access< E >::err_.

◆ error() [2/2]

template<class E >
const E & Aleph::bad_expected_access< E >::error ( ) const &
inlinenoexcept

Access the stored error (const lvalue).

Returns
Const reference to the error.
Complexity O(1). Does not throw.

Definition at line 266 of file ah-cpp-compat.H.

References Aleph::bad_expected_access< E >::err_.

◆ what()

template<class E >
const char * Aleph::bad_expected_access< E >::what ( ) const
inlineoverridenoexcept

Get exception description.

Returns
Static error string.
Complexity O(1). Does not throw.

Definition at line 257 of file ah-cpp-compat.H.

Member Data Documentation

◆ err_

template<class E >
E Aleph::bad_expected_access< E >::err_
private

The documentation for this class was generated from the following file: