xentara-utils v2.0.4
The Xentara Utility Library
Loading...
Searching...
No Matches
xentara::utils::eh::expected< Type, Error > Class Template Reference

Implementation of C++23 std::expected More...

#include <xentara/utils/eh/expected.hpp>

Related Symbols

(Note that these are not member symbols.)

template<typename RelatedType , typename Type , typename Error >
constexpr auto expectedCast (const expected< Type, Error > &source) noexcept(std::is_nothrow_constructible_v< expected< RelatedType, Error >, const expected< RelatedType, Error > & >) -> expected< RelatedType, Error >
 Explicitly casts an expected to a related type.
 
template<typename RelatedType , typename Type , typename Error >
constexpr auto expectedCast (expected< Type, Error > &&source) noexcept(std::is_nothrow_constructible_v< expected< RelatedType, Error >, expected< RelatedType, Error > && >) -> expected< RelatedType, Error >
 Explicitly casts an expected to a related type.
 

Detailed Description

template<typename Type, typename Error>
class xentara::utils::eh::expected< Type, Error >

Implementation of C++23 std::expected

This is an implementation of the proposed std::expected from C++23, taken from https://github.com/TartanLlama/expected.

Friends And Related Symbol Documentation

◆ expectedCast() [1/2]

template<typename RelatedType , typename Type , typename Error >
constexpr auto expectedCast ( const expected< Type, Error > &  source) -> expected<RelatedType, Error>
related

Explicitly casts an expected to a related type.

This function casts the expected to an expected with a related type and the same error type, using an explicit cast to convert the value. This allows casting even if the target type is not implicitly, but explicitly constructible to the source type.

◆ expectedCast() [2/2]

template<typename RelatedType , typename Type , typename Error >
constexpr auto expectedCast ( expected< Type, Error > &&  source) -> expected<RelatedType, Error>
related

Explicitly casts an expected to a related type.

This function casts the expected to an expected with a related type and the same error type, using an explicit cast to convert the value. This allows casting even if the target type is not implicitly, but explicitly constructible to the source type.