libQuotient
A Qt library for building matrix clients
Loading...
Searching...
No Matches
Quotient::Expected< T, E > Class Template Reference

A minimal subset of std::expected from C++23. More...

#include <expected.h>

Public Types

using value_type = T
 
using error_type = E
 

Public Member Functions

 Expected ()=default
 
 Expected (const Expected &)=default
 
 Expected (Expected &&) noexcept=default
 
 ~Expected ()=default
 
template<typename X >
requires is_constructible_v<X>
Q_IMPLICIT Expected (X &&x)
 
Expectedoperator= (const Expected &)=default
 
Expectedoperator= (Expected &&) noexcept=default
 
template<typename X >
requires is_constructible_v<X>
Expectedoperator= (X &&x)
 
bool has_value () const
 
 operator bool () const
 
const value_typevalue () const &
 
value_typevalue () &
 
value_type value () &&
 
const value_typeoperator* () const &
 
value_typeoperator* () &
 
const value_typeoperator-> () const &
 
value_typeoperator-> () &
 
template<class U >
const Tvalue_or (const U &fallback) const &
 
template<class U >
T && value_or (U &&fallback) &&
 
T && move_value_or (T &&fallback)
 
const Eerror () const &
 
Eerror () &
 

Detailed Description

template<typename T, typename E>
requires (!std::is_same_v<T, E>)
class Quotient::Expected< T, E >

A minimal subset of std::expected from C++23.

Definition at line 14 of file expected.h.

Member Typedef Documentation

◆ error_type

template<typename T , typename E >
using Quotient::Expected< T, E >::error_type = E

Definition at line 22 of file expected.h.

◆ value_type

template<typename T , typename E >
using Quotient::Expected< T, E >::value_type = T

Definition at line 21 of file expected.h.

Constructor & Destructor Documentation

◆ Expected() [1/4]

template<typename T , typename E >
Quotient::Expected< T, E >::Expected ( )
default

◆ Expected() [2/4]

template<typename T , typename E >
Quotient::Expected< T, E >::Expected ( const Expected< T, E > &  )
default

◆ Expected() [3/4]

template<typename T , typename E >
Quotient::Expected< T, E >::Expected ( Expected< T, E > &&  )
defaultnoexcept

◆ ~Expected()

template<typename T , typename E >
Quotient::Expected< T, E >::~Expected ( )
default

◆ Expected() [4/4]

template<typename T , typename E >
template<typename X >
requires is_constructible_v<X>
Q_IMPLICIT Quotient::Expected< T, E >::Expected ( X &&  x)
inline

Definition at line 31 of file expected.h.

Member Function Documentation

◆ error() [1/2]

template<typename T , typename E >
E & Quotient::Expected< T, E >::error ( ) &
inline

Definition at line 81 of file expected.h.

◆ error() [2/2]

template<typename T , typename E >
const E & Quotient::Expected< T, E >::error ( ) const &
inline

Definition at line 80 of file expected.h.

◆ has_value()

template<typename T , typename E >
bool Quotient::Expected< T, E >::has_value ( ) const
inline

Definition at line 45 of file expected.h.

◆ move_value_or()

template<typename T , typename E >
T && Quotient::Expected< T, E >::move_value_or ( T &&  fallback)
inline

Definition at line 73 of file expected.h.

◆ operator bool()

template<typename T , typename E >
Quotient::Expected< T, E >::operator bool ( ) const
inlineexplicit

Definition at line 46 of file expected.h.

◆ operator*() [1/2]

template<typename T , typename E >
value_type & Quotient::Expected< T, E >::operator* ( ) &
inline

Definition at line 53 of file expected.h.

◆ operator*() [2/2]

template<typename T , typename E >
const value_type & Quotient::Expected< T, E >::operator* ( ) const &
inline

Definition at line 52 of file expected.h.

◆ operator->() [1/2]

template<typename T , typename E >
value_type * Quotient::Expected< T, E >::operator-> ( ) &
inline

Definition at line 56 of file expected.h.

◆ operator->() [2/2]

template<typename T , typename E >
const value_type * Quotient::Expected< T, E >::operator-> ( ) const &
inline

Definition at line 55 of file expected.h.

◆ operator=() [1/3]

template<typename T , typename E >
Expected & Quotient::Expected< T, E >::operator= ( const Expected< T, E > &  )
default

◆ operator=() [2/3]

template<typename T , typename E >
Expected & Quotient::Expected< T, E >::operator= ( Expected< T, E > &&  )
defaultnoexcept

◆ operator=() [3/3]

template<typename T , typename E >
template<typename X >
requires is_constructible_v<X>
Expected & Quotient::Expected< T, E >::operator= ( X &&  x)
inline

Definition at line 39 of file expected.h.

◆ value() [1/3]

template<typename T , typename E >
value_type & Quotient::Expected< T, E >::value ( ) &
inline

Definition at line 49 of file expected.h.

◆ value() [2/3]

template<typename T , typename E >
value_type Quotient::Expected< T, E >::value ( ) &&
inline

Definition at line 50 of file expected.h.

◆ value() [3/3]

template<typename T , typename E >
const value_type & Quotient::Expected< T, E >::value ( ) const &
inline

Definition at line 48 of file expected.h.

◆ value_or() [1/2]

template<typename T , typename E >
template<class U >
const T & Quotient::Expected< T, E >::value_or ( const U fallback) const &
inline

Definition at line 59 of file expected.h.

◆ value_or() [2/2]

template<typename T , typename E >
template<class U >
T && Quotient::Expected< T, E >::value_or ( U &&  fallback) &&
inline

Definition at line 66 of file expected.h.


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