StormByte 2.0.0
C++26 foundation of the StormByte suite
 
Loading...
Searching...
No Matches
expected.hxx File Reference
#include <StormByte/safe/pointers.hxx>
#include <StormByte/type_traits.hxx>
#include <expected>
#include <format>
#include <type_traits>
#include <memory>
#include <string>
Include dependency graph for expected.hxx:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  StormByte
 Root namespace of the StormByte suite.
 

Typedefs

template<typename T , class E >
using StormByte::Expected = std::conditional_t< Type::Reference< T >, std::expected< std::reference_wrapper< std::remove_reference_t< T > >, Safe::Shared< E > >, std::expected< T, Safe::Shared< E > > >
 std::expected alias with reference and shared-error handling.
 

Functions

template<typename E >
auto StormByte::Unexpected (Safe::Shared< E > error)
 Forwards an error already stored by Expected.
 
template<typename E >
auto StormByte::Unexpected (std::shared_ptr< E >)=delete
 Rejects a std::shared_ptr.
 
template<typename E >
requires ( !requires { typename std::remove_cvref_t<E>::element_type; } || !Type::SameAs<std::remove_cvref_t<E>, Safe::Shared<typename std::remove_cvref_t<E>::element_type>> )
auto StormByte::Unexpected (E &&error)
 Builds std::unexpected by constructing E.
 
template<typename Base , typename Derived >
requires Type::DerivedFrom<std::decay_t<Derived>, Base> && (!Type::SameAs<Base, std::decay_t<Derived>>)
auto StormByte::Unexpected (Derived &&error) -> std::unexpected< Safe::Shared< Base > >
 Builds std::unexpected<shared_ptr<Base>> from a Derived instance.
 
template<typename E , typename... Args>
auto StormByte::Unexpected (const std::string &fmt, Args &&... args)
 Builds std::unexpected from a format string and E(string).