FastMM documentation
FastMM C++ API 0.6.0
Public headers, tier 1 and tier 2
Loading...
Searching...
No Matches
fastmm::Result< T, E > Class Template Reference

#include <fastmm/core/result.hpp>

Public Types

using value_type = T
 
using error_type = E
 

Public Member Functions

constexpr Result (const T &v) noexcept(std::is_nothrow_copy_constructible_v< T >)
 
constexpr Result (T &&v) noexcept(std::is_nothrow_move_constructible_v< T >)
 
constexpr Result (Unexpected< E > u) noexcept(std::is_nothrow_move_constructible_v< E >)
 
constexpr Result (const Result &o) noexcept(std::is_nothrow_copy_constructible_v< T > &&std::is_nothrow_copy_constructible_v< E >)
 
constexpr Result (Result &&o) noexcept(std::is_nothrow_move_constructible_v< T > &&std::is_nothrow_move_constructible_v< E >)
 
constexpr Result & operator= (const Result &o)
 
constexpr Result & operator= (Result &&o) noexcept(std::is_nothrow_move_constructible_v< T > &&std::is_nothrow_move_constructible_v< E >)
 
 ~Result ()
 
constexpr bool has_value () const noexcept
 
constexpr operator bool () const noexcept
 
constexpr T & value () &noexcept
 
constexpr const T & value () const &noexcept
 
constexpr T && value () &&noexcept
 
constexpr const E & error () const noexcept
 
constexpr E & error () noexcept
 
constexpr T & operator* () noexcept
 
constexpr const T & operator* () const noexcept
 
constexpr T * operator-> () noexcept
 
constexpr const T * operator-> () const noexcept
 
template<class U >
constexpr T value_or (U &&fallback) const
 
template<class F >
constexpr auto and_then (F &&f) const -> std::invoke_result_t< F, const T & >
 Monadic chaining: f(T) must return Result<U, E>.
 
template<class F >
constexpr auto map (F &&f) const -> Result< std::invoke_result_t< F, const T & >, E >
 map: f(T) returns U, yields Result<U, E>.
 

Member Typedef Documentation

◆ value_type

template<class T , class E >
using fastmm::Result< T, E >::value_type = T

◆ error_type

template<class T , class E >
using fastmm::Result< T, E >::error_type = E

Constructor & Destructor Documentation

◆ Result() [1/5]

template<class T , class E >
constexpr fastmm::Result< T, E >::Result ( const T &  v)
inlineconstexprnoexcept

◆ Result() [2/5]

template<class T , class E >
constexpr fastmm::Result< T, E >::Result ( T &&  v)
inlineconstexprnoexcept

◆ Result() [3/5]

template<class T , class E >
constexpr fastmm::Result< T, E >::Result ( Unexpected< E >  u)
inlineconstexprnoexcept

◆ Result() [4/5]

template<class T , class E >
constexpr fastmm::Result< T, E >::Result ( const Result< T, E > &  o)
inlineconstexprnoexcept

◆ Result() [5/5]

template<class T , class E >
constexpr fastmm::Result< T, E >::Result ( Result< T, E > &&  o)
inlineconstexprnoexcept

◆ ~Result()

template<class T , class E >
fastmm::Result< T, E >::~Result ( )
inline

Member Function Documentation

◆ operator=() [1/2]

template<class T , class E >
constexpr Result & fastmm::Result< T, E >::operator= ( const Result< T, E > &  o)
inlineconstexpr

◆ operator=() [2/2]

template<class T , class E >
constexpr Result & fastmm::Result< T, E >::operator= ( Result< T, E > &&  o)
inlineconstexprnoexcept

◆ has_value()

template<class T , class E >
constexpr bool fastmm::Result< T, E >::has_value ( ) const
inlineconstexprnoexcept

◆ operator bool()

template<class T , class E >
constexpr fastmm::Result< T, E >::operator bool ( ) const
inlineexplicitconstexprnoexcept

◆ value() [1/3]

template<class T , class E >
constexpr T & fastmm::Result< T, E >::value ( ) &
inlineconstexprnoexcept

◆ value() [2/3]

template<class T , class E >
constexpr const T & fastmm::Result< T, E >::value ( ) const &
inlineconstexprnoexcept

◆ value() [3/3]

template<class T , class E >
constexpr T && fastmm::Result< T, E >::value ( ) &&
inlineconstexprnoexcept

◆ error() [1/2]

template<class T , class E >
constexpr const E & fastmm::Result< T, E >::error ( ) const
inlineconstexprnoexcept

◆ error() [2/2]

template<class T , class E >
constexpr E & fastmm::Result< T, E >::error ( )
inlineconstexprnoexcept

◆ operator*() [1/2]

template<class T , class E >
constexpr T & fastmm::Result< T, E >::operator* ( )
inlineconstexprnoexcept

◆ operator*() [2/2]

template<class T , class E >
constexpr const T & fastmm::Result< T, E >::operator* ( ) const
inlineconstexprnoexcept

◆ operator->() [1/2]

template<class T , class E >
constexpr T * fastmm::Result< T, E >::operator-> ( )
inlineconstexprnoexcept

◆ operator->() [2/2]

template<class T , class E >
constexpr const T * fastmm::Result< T, E >::operator-> ( ) const
inlineconstexprnoexcept

◆ value_or()

template<class T , class E >
template<class U >
constexpr T fastmm::Result< T, E >::value_or ( U &&  fallback) const
inlineconstexpr

◆ and_then()

template<class T , class E >
template<class F >
constexpr auto fastmm::Result< T, E >::and_then ( F &&  f) const -> std::invoke_result_t<F, const T&>
inlineconstexpr

Monadic chaining: f(T) must return Result<U, E>.

◆ map()

template<class T , class E >
template<class F >
constexpr auto fastmm::Result< T, E >::map ( F &&  f) const -> Result<std::invoke_result_t<F, const T&>, E>
inlineconstexpr

map: f(T) returns U, yields Result<U, E>.

Member Data Documentation

◆ value_

template<class T , class E >
T fastmm::Result< T, E >::value_

◆ error_

template<class T , class E >
E fastmm::Result< T, E >::error_