libivon 0.1.0
Voice-over-IP library
Loading...
Searching...
No Matches
ivon::expected_void< E > Class Template Reference

Lightweight C++20-compatible replacement for std::expected<void, E>. More...

#include <ivon_types.hpp>

Public Member Functions

constexpr expected_void () noexcept=default
 Construct a success value.
 
constexpr expected_void (E error) noexcept(std::is_nothrow_move_constructible_v< E >)
 Construct a failure value.
 
constexpr bool has_value () const noexcept
 
constexpr operator bool () const noexcept
 
constexpr const E & error () const &noexcept
 
constexpr E & error () &noexcept
 
constexpr E && error () &&noexcept
 

Detailed Description

template<typename E>
class ivon::expected_void< E >

Lightweight C++20-compatible replacement for std::expected<void, E>.

Default-constructed state represents success (has_value() == true). Constructing with an error value represents failure.

When C++23 or later is available, an implicit conversion operator to std::expected<void, E> is provided so callers can use the standard type transparently.

Constructor & Destructor Documentation

◆ expected_void() [1/2]

template<typename E >
constexpr ivon::expected_void< E >::expected_void ( )
constexprdefaultnoexcept

Construct a success value.

◆ expected_void() [2/2]

template<typename E >
constexpr ivon::expected_void< E >::expected_void ( error)
inlineconstexprnoexcept

Construct a failure value.

Member Function Documentation

◆ error() [1/3]

template<typename E >
constexpr E && ivon::expected_void< E >::error ( ) &&
inlineconstexprnoexcept

◆ error() [2/3]

template<typename E >
constexpr E & ivon::expected_void< E >::error ( ) &
inlineconstexprnoexcept

◆ error() [3/3]

template<typename E >
constexpr const E & ivon::expected_void< E >::error ( ) const &
inlineconstexprnoexcept

◆ has_value()

template<typename E >
constexpr bool ivon::expected_void< E >::has_value ( ) const
inlineconstexprnoexcept

◆ operator bool()

template<typename E >
constexpr ivon::expected_void< E >::operator bool ( ) const
inlineexplicitconstexprnoexcept

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