cvw::unexpected
Wrapper type for constructing expected objects in error state. More...
#include <expected.hpp>
Public Functions
| Name | |
|---|---|
| unexpected() =delete Deleted default constructor. | |
| template <typenameErr =E> constexpr | unexpected(Err && e) Constructs unexpected from an error value. |
| template <typename... Args> constexpr | unexpected(std::in_place_t , Args &&... args) Constructs unexpected in-place with arguments. |
| template <typenameU ,typename... Args> constexpr | unexpected(std::in_place_t , std::initializer_list<U> il, Args &&... args) Constructs unexpected in-place with initializer list. |
| constexprconstE & | error() const Returns const reference to the error. |
| constexprE & | error() Returns reference to the error. |
| constexprconstE && | error() const Returns const rvalue reference to the error. |
| constexprE && | error() Returns rvalue reference to the error. |
| void | swap(unexpected & other) Swaps the error with another unexpected. |
Friends
| Name | |
|---|---|
| constexprbool | operator==(constunexpected & a, constunexpected<E2> & b) Compares two unexpected objects for equality. |
Detailed Description
template <typenameE>
class cvw::unexpected;Wrapper type for constructing expected objects in error state.
Template Parameters:
- E Error type to wrap.
Public Functions Documentation
function unexpected
unexpected() =deleteDeleted default constructor.
function unexpected
template <typenameErr =E>
inline explicit constexpr unexpected(
Err && e
)Constructs unexpected from an error value.
Parameters:
- e Error value to wrap.
Template Parameters:
- Err Forwarded error type.
function unexpected
template <typename... Args>
inline explicit constexpr unexpected(
std::in_place_t ,
Args &&... args
)Constructs unexpected in-place with arguments.
Parameters:
- args Arguments to forward to E constructor.
Template Parameters:
- Args Constructor argument types.
function unexpected
template <typenameU ,
typename... Args>
inline explicit constexpr unexpected(
std::in_place_t ,
std::initializer_list< U > il,
Args &&... args
)Constructs unexpected in-place with initializer list.
Parameters:
- il Initializer list.
- args Additional arguments.
Template Parameters:
- U Element type of initializer list.
- Args Constructor argument types.
function error
inline constexprconstE & error() constReturns const reference to the error.
Exceptions:
- None.
Return: Const reference to the error.
function error
inline constexprE & error()Returns reference to the error.
Exceptions:
- None.
Return: Reference to the error.
function error
inline constexprconstE && error() constReturns const rvalue reference to the error.
Exceptions:
- None.
Return: Const rvalue reference to the error.
function error
inline constexprE && error()Returns rvalue reference to the error.
Exceptions:
- None.
Return: Rvalue reference to the error.
function swap
inline void swap(
unexpected & other
)Swaps the error with another unexpected.
Parameters:
- other Other unexpected to swap with.
Exceptions:
- None if E is nothrow swappable.
Since: 0.1
Note: None.
Warning: None.
Friends
friend operator==
friend constexprbool operator==(
constunexpected & a,
constunexpected<E2> & b
);Compares two unexpected objects for equality.
Parameters:
- a First unexpected.
- b Second unexpected.
Exceptions:
- None.
Template Parameters:
- E2 Error type of the other unexpected.
Return: true if errors are equal, false otherwise.
Updated on 2026-05-17 at 13:22:38 +0000