Result
cpp::bitwizeshift::failure< E > Class Template Reference

A semantic type used for distinguishing failure values in an API that returns result types. More...

#include <result.hpp>

Public Types

using error_type = E
 

Public Member Functions

 failure ()=default
 Constructs a failure via default construction.
 
template<typename... Args, typename = typename std::enable_if<std::is_constructible<E,Args...>::value>::type>
constexpr failure (in_place_t, Args &&...args) noexcept(std::is_nothrow_constructible< E, Args... >::value)
 Constructs a failure by delegating construction to the underlying constructor. More...
 
template<typename U , typename... Args, typename = typename std::enable_if<std::is_constructible<E,std::initializer_list<U>,Args...>::value>::type>
constexpr failure (in_place_t, std::initializer_list< U > ilist, Args &&...args) noexcept(std::is_nothrow_constructible< E, std::initializer_list< U >, Args... >::value)
 Constructs a failure by delegating construction to the underlying constructor. More...
 
 failure (const failure &other)=default
 Constructs this failure by copying the contents of an existing one. More...
 
 failure (failure &&other)=default
 Constructs this failure by moving the contents of an existing one. More...
 
template<typename E2 , typename = typename std::enable_if<std::is_constructible<E,const E2&>::value>::type>
constexpr failure (const failure< E2 > &other) noexcept(std::is_nothrow_constructible< E, const E2 &>::value)
 Constructs this failure by copy-converting other. More...
 
template<typename E2 , typename = typename std::enable_if<std::is_constructible<E,E2&&>::value>::type>
constexpr failure (failure< E2 > &&other) noexcept(std::is_nothrow_constructible< E, E2 &&>::value)
 Constructs this failure by move-converting other. More...
 
template<typename E2 , typename = typename std::enable_if<detail::failure_is_value_assignable<E,E2>::value>::type>
RESULT_CPP14_CONSTEXPR auto operator= (E2 &&error) noexcept(std::is_nothrow_assignable< E, E2 >::value||std::is_lvalue_reference< E >::value) -> failure &
 Assigns the value of error to this failure through move-assignment. More...
 
auto operator= (const failure &other) -> failure &=default
 Assigns the contents of other to this by copy-assignment. More...
 
auto operator= (failure &&other) -> failure &=default
 Assigns the contents of other to this by move-assignment. More...
 
template<typename E2 , typename = typename std::enable_if<std::is_assignable<E&,const E2&>::value>::type>
RESULT_CPP14_CONSTEXPR auto operator= (const failure< E2 > &other) noexcept(std::is_nothrow_assignable< E, const E2 &>::value) -> failure &
 Assigns the contents of other to this by copy conversion. More...
 
template<typename E2 , typename = typename std::enable_if<std::is_assignable<E&,E2&&>::value>::type>
RESULT_CPP14_CONSTEXPR auto operator= (failure< E2 > &&other) noexcept(std::is_nothrow_assignable< E, E2 &&>::value) -> failure &
 Assigns the contents of other to this by move conversion. More...
 
template<typename E2 , typename std::enable_if< detail::failure_is_implicit_value_convertible< E, E2 >::value, int >::type = 0>
constexpr failure (E2 &&error) noexcept(std::is_nothrow_constructible< E, E2 >::value)
 Constructs a failure from the given error. More...
 
template<typename E2 , typename std::enable_if< detail::failure_is_explicit_value_convertible< E, E2 >::value, int >::type = 0>
constexpr failure (E2 &&error) noexcept(std::is_nothrow_constructible< E, E2 >::value)
 Constructs a failure from the given error. More...
 
RESULT_CPP14_CONSTEXPR auto error () &noexcept -> typename std::add_lvalue_reference< E >::type
 Gets the underlying error. More...
 
RESULT_CPP14_CONSTEXPR auto error () &&noexcept -> typename std::add_rvalue_reference< E >::type
 Gets the underlying error. More...
 
constexpr auto error () const &noexcept -> typename std::add_lvalue_reference< typename std::add_const< E >::type >::type
 Gets the underlying error. More...
 
constexpr auto error () const &&noexcept -> typename std::add_rvalue_reference< typename std::add_const< E >::type >::type
 Gets the underlying error. More...
 

Detailed Description

template<typename E>
class cpp::bitwizeshift::failure< E >

A semantic type used for distinguishing failure values in an API that returns result types.

Template Parameters
Ethe error type

Definition at line 306 of file result.hpp.

Constructor & Destructor Documentation

◆ failure() [1/8]

template<typename E >
template<typename... Args, typename = typename std::enable_if<std::is_constructible<E,Args...>::value>::type>
constexpr cpp::bitwizeshift::failure< E >::failure ( in_place_t  ,
Args &&...  args 
) const
noexcept

Constructs a failure by delegating construction to the underlying constructor.

Parameters
argsthe arguments to forward to E's constructor

◆ failure() [2/8]

template<typename E >
template<typename U , typename... Args, typename = typename std::enable_if<std::is_constructible<E,std::initializer_list<U>,Args...>::value>::type>
constexpr cpp::bitwizeshift::failure< E >::failure ( in_place_t  ,
std::initializer_list< U >  ilist,
Args &&...  args 
) const
noexcept

Constructs a failure by delegating construction to the underlying constructor.

Parameters
ilistthe initializer list
argsthe arguments to forward to E's constructor

◆ failure() [3/8]

template<typename E >
template<typename E2 , typename std::enable_if< detail::failure_is_implicit_value_convertible< E, E2 >::value, int >::type = 0>
constexpr cpp::bitwizeshift::failure< E >::failure ( E2 &&  error) const
noexcept

Constructs a failure from the given error.

Parameters
errorthe error to create a failure from

◆ failure() [4/8]

template<typename E >
template<typename E2 , typename std::enable_if< detail::failure_is_explicit_value_convertible< E, E2 >::value, int >::type = 0>
constexpr cpp::bitwizeshift::failure< E >::failure ( E2 &&  error) const
explicitnoexcept

Constructs a failure from the given error.

Parameters
errorthe error to create a failure from

◆ failure() [5/8]

template<typename E >
cpp::bitwizeshift::failure< E >::failure ( const failure< E > &  other)
default

Constructs this failure by copying the contents of an existing one.

Parameters
otherthe other failure to copy

◆ failure() [6/8]

template<typename E >
cpp::bitwizeshift::failure< E >::failure ( failure< E > &&  other)
default

Constructs this failure by moving the contents of an existing one.

Parameters
otherthe other failure to move

◆ failure() [7/8]

template<typename E >
template<typename E2 , typename = typename std::enable_if<std::is_constructible<E,const E2&>::value>::type>
constexpr cpp::bitwizeshift::failure< E >::failure ( const failure< E2 > &  other) const &
noexcept

Constructs this failure by copy-converting other.

Parameters
otherthe other failure to copy

◆ failure() [8/8]

template<typename E >
template<typename E2 , typename = typename std::enable_if<std::is_constructible<E,E2&&>::value>::type>
constexpr cpp::bitwizeshift::failure< E >::failure ( failure< E2 > &&  other) const &&
noexcept

Constructs this failure by move-converting other.

Parameters
otherthe other failure to copy

Member Function Documentation

◆ error() [1/4]

template<typename E >
RESULT_CPP14_CONSTEXPR auto cpp::bitwizeshift::failure< E >::error ( ) & -> typename std::add_lvalue_reference< E >::type
noexcept

Gets the underlying error.

Returns
the underlying error

◆ error() [2/4]

template<typename E >
RESULT_CPP14_CONSTEXPR auto cpp::bitwizeshift::failure< E >::error ( ) && -> typename std::add_rvalue_reference< E >::type
noexcept

Gets the underlying error.

Returns
the underlying error

◆ error() [3/4]

template<typename E >
constexpr auto cpp::bitwizeshift::failure< E >::error ( ) const & -> typename std::add_lvalue_reference< typename std::add_const< E >::type >::type
noexcept

Gets the underlying error.

Returns
the underlying error

◆ error() [4/4]

template<typename E >
constexpr auto cpp::bitwizeshift::failure< E >::error ( ) const && -> typename std::add_rvalue_reference< typename std::add_const< E >::type >::type
noexcept

Gets the underlying error.

Returns
the underlying error

◆ operator=() [1/5]

template<typename E >
template<typename E2 , typename = typename std::enable_if<detail::failure_is_value_assignable<E,E2>::value>::type>
RESULT_CPP14_CONSTEXPR auto cpp::bitwizeshift::failure< E >::operator= ( E2 &&  error) -> failure &
noexcept

Assigns the value of error to this failure through move-assignment.

Parameters
errorthe value to assign
Returns
reference to (*this)

◆ operator=() [2/5]

template<typename E >
auto cpp::bitwizeshift::failure< E >::operator= ( const failure< E > &  other) -> failure &=default
default

Assigns the contents of other to this by copy-assignment.

Parameters
otherthe other failure to copy
Returns
reference to (*this)

◆ operator=() [3/5]

template<typename E >
auto cpp::bitwizeshift::failure< E >::operator= ( failure< E > &&  other) -> failure &=default
default

Assigns the contents of other to this by move-assignment.

Parameters
otherthe other failure to move
Returns
reference to (*this)

◆ operator=() [4/5]

template<typename E >
template<typename E2 , typename = typename std::enable_if<std::is_assignable<E&,const E2&>::value>::type>
RESULT_CPP14_CONSTEXPR auto cpp::bitwizeshift::failure< E >::operator= ( const failure< E2 > &  other) const & -> failure &
noexcept

Assigns the contents of other to this by copy conversion.

Parameters
otherthe other failure to copy-convert
Returns
reference to (*this)

◆ operator=() [5/5]

template<typename E >
template<typename E2 , typename = typename std::enable_if<std::is_assignable<E&,E2&&>::value>::type>
RESULT_CPP14_CONSTEXPR auto cpp::bitwizeshift::failure< E >::operator= ( failure< E2 > &&  other) && -> failure &
noexcept

Assigns the contents of other to this by move conversion.

Parameters
otherthe other failure to move-convert
Returns
reference to (*this)

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