STX  1.0.0
List of all members
stx::Err< E > Struct Template Reference

#include <option_result.h>

Detailed Description

template<typename E>
struct stx::Err< E >

error-value variant for Result<T, E> wrapping the contained error value of type E

Note that Err is only a value-forwarding type. An Err<E> can only be constructed with an r-value of type E. What does this mean?

For example, You can:

Result<int, vector<int>> a = Err(vector{1, 2, 3, 4});

You can't:

vector<int> x {1, 2, 3, 4};
Result<int, vector<int>> a = Err(x);

But, to explicitly make a take ownership, you will:

vector<int> x {1, 2, 3, 4};
Result<int, vector<int>> a = Err(std::move(x));

Constexpr ?

C++ 17 and above

Member Typedef Documentation

◆ value_type

template<typename E>
using stx::Err< E >::value_type = E

Constructor & Destructor Documentation

◆ Err() [1/3]

template<typename E>
constexpr stx::Err< E >::Err ( E &&  value)
inlineexplicit

an Err<E> can only be constructed with an r-value of type E

◆ Err() [2/3]

template<typename E>
constexpr stx::Err< E >::Err ( Err< E > &&  rhs)
default

◆ Err() [3/3]

template<typename E>
constexpr stx::Err< E >::Err ( Err< E > const &  )
default

◆ ~Err()

template<typename E>
STX_CXX20_DESTRUCTOR_CONSTEXPR stx::Err< E >::~Err ( )
default

Member Function Documentation

◆ operator!=() [1/2]

template<typename E>
template<typename F >
constexpr bool stx::Err< E >::operator!= ( Err< F > const &  cmp) const
inline

◆ operator!=() [2/2]

template<typename E>
template<typename F >
constexpr bool stx::Err< E >::operator!= ( Ok< F > const &  ) const
inlinenoexcept

◆ operator=() [1/2]

template<typename E>
constexpr Err& stx::Err< E >::operator= ( Err< E > &&  rhs)
default

◆ operator=() [2/2]

template<typename E>
constexpr Err& stx::Err< E >::operator= ( Err< E > const &  )
default

◆ operator==() [1/2]

template<typename E>
template<typename F >
constexpr bool stx::Err< E >::operator== ( Err< F > const &  cmp) const
inline

◆ operator==() [2/2]

template<typename E>
template<typename F >
constexpr bool stx::Err< E >::operator== ( Ok< F > const &  ) const
inlinenoexcept

◆ value() [1/4]

template<typename E>
constexpr E const& stx::Err< E >::value ( ) const &
inlinenoexcept

◆ value() [2/4]

template<typename E>
constexpr E& stx::Err< E >::value ( ) &
inlinenoexcept

◆ value() [3/4]

template<typename E>
constexpr E const stx::Err< E >::value ( ) const &&
inline

◆ value() [4/4]

template<typename E>
constexpr E stx::Err< E >::value ( ) &&
inline

Friends And Related Function Documentation

◆ Result

template<typename E>
template<typename Tp , typename Er >
friend struct Result
friend

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