![]() |
Arene Base
Fundamental Utilities For Safety Critical C++
|
Specialization of result<T, E> for void value types. More...

Public Types | |
| using | error_type |
The type when the result contains an error. | |
| using | error_type = E |
The type when the result contains an error. | |
| using | value_type |
The type when the result contains a value. | |
| using | value_type = void |
The type when the result contains a value. | |
Public Member Functions | |
| constexpr | result ()=default |
Constructs a result with a default-constructed value_type . Does not participate in overload resolution if value_type is not default constructible. | |
| constexpr | result ()=default |
Constructs a result with the value-channel engaged. | |
| constexpr | result (in_place_error_t, P &&... args) noexcept(noexcept(base_type(in_place_error, std::forward< P >(args)...))) |
Constructs a result containing the error_type by way of direct-non-list-initialization. | |
| template<class... P, constraints< std::enable_if_t< std::is_constructible< error_type, P &&... >::value > > = nullptr> | |
| constexpr | result (in_place_error_t, P &&... args) noexcept(noexcept(base_type(in_place_error, std::forward< P >(args)...))) |
Constructs a result containing the error_type by way of direct-non-list-initialization. | |
| constexpr | result (in_place_value_t) noexcept(noexcept(base_type(in_place_value, monostate{}))) |
Constructs a result with the value-channel engaged. | |
| constexpr | result (in_place_value_t, monostate) noexcept(noexcept(base_type(in_place_value, monostate{}))) |
Constructs a result with the value-channel engaged. Provided for backwards compatibility. | |
| constexpr | result (in_place_value_t, P &&... args) noexcept(noexcept(base_type(in_place_value, std::forward< P >(args)...))) |
Constructs a result containing the value_type by way of direct-non-list-initialization. | |
| constexpr | result (result &&move) noexcept(noexcept(base_type(std::declval< result && >())))=default |
| Default move constructor. | |
| constexpr | result (result &&move) noexcept(noexcept(base_type(std::declval< result && >())))=default |
| Default move constructor. | |
| constexpr | result (result const ©) noexcept(noexcept(base_type(std::declval< result const & >())))=default |
| Default copy constructor. | |
| constexpr | result (result const ©) noexcept(noexcept(base_type(std::declval< result const & >())))=default |
| Default copy constructor. | |
| ~result ()=default | |
| Destroy the stored value or error. | |
| ~result ()=default | |
| Destroy the stored value or error. | |
| void | emplace (in_place_value_t) noexcept |
| Emplaces the void value into the result. | |
| auto | emplace (in_place_value_t, ArgTypes &&... args) noexcept -> value_type & |
| Emplaces a value into the result. | |
| ARENE_NODISCARD constexpr auto | error () &&noexcept -> error_type && |
| Accesses a reference to the content of the error channel. | |
| ARENE_NODISCARD constexpr auto | error () &noexcept -> error_type & |
| Accesses a reference to the content of the error channel. | |
| ARENE_NODISCARD constexpr auto | error () const &&noexcept -> error_type const && |
| Accesses a reference to the content of the error channel. | |
| ARENE_NODISCARD constexpr auto | error () const &noexcept -> error_type const & |
| Accesses a reference to the content of the error channel. | |
| ARENE_NODISCARD constexpr auto | has_value (value_type const &val) const noexcept(noexcept(val==std::declval< value_type >())) -> bool |
| Checks if the value channel contains a specific value. | |
| ARENE_NODISCARD constexpr auto | operator* () &&noexcept -> value_type && |
| Accesses a reference to the content of the value channel. | |
| ARENE_NODISCARD constexpr auto | operator* () &noexcept -> value_type & |
| Accesses a reference to the content of the value channel. | |
| ARENE_NODISCARD constexpr auto | operator* () const &&noexcept -> value_type const && |
| Accesses a reference to the content of the value channel. | |
| constexpr void | operator* () const &noexcept |
| Access the content of the value channel. | |
| ARENE_NODISCARD constexpr auto | operator* () const &noexcept -> value_type const & |
| Accesses a reference to the content of the value channel. | |
| ARENE_NODISCARD constexpr auto | operator-> () const noexcept -> value_type const * |
| Accesses a pointer to the content of the value channel. | |
| ARENE_NODISCARD constexpr auto | operator-> () noexcept -> value_type * |
| Accesses a pointer to the content of the value channel. | |
| constexpr auto | operator= (copy_assign_arg const &other) noexcept -> result & |
Copy-assignment for the case that value_type and error_type satisfy std::is_nothrow_copy_constructible and std::is_nothrow_copy_assignable, otherwise a dummy assignment operator that can never be called. | |
| constexpr auto | operator= (copy_assign_arg const &other) noexcept -> result & |
Copy-assignment for the case that error_type satisfies std::is_nothrow_copy_constructible and std::is_nothrow_copy_assignable, otherwise a dummy assignment operator that can never be called. | |
| constexpr auto | operator= (deleted_copy_assign_arg const &other) noexcept -> result &=delete |
Deleted Copy-assignment if value_type or error_type do not satisfy std::is_nothrow_copy_constructible and std::is_nothrow_copy_assignable, otherwise a deleted dummy assignment operator. | |
| constexpr auto | operator= (deleted_copy_assign_arg const &other) noexcept -> result &=delete |
Deleted Copy-assignment if error_type does not satisfy std::is_nothrow_copy_constructible and std::is_nothrow_copy_assignable, otherwise a deleted dummy assignment operator. | |
| constexpr auto | operator= (deleted_move_assign_arg &&other) noexcept -> result &=delete |
Deleted Move-assignment if value_type or error_type do not satisfy std::is_nothrow_move_constructible and std::is_nothrow_move_assignable, otherwise a deleted dummy assignment operator. | |
| constexpr auto | operator= (deleted_move_assign_arg &&other) noexcept -> result &=delete |
Deleted Move-assignment if error_type does not satisfy std::is_nothrow_move_constructible and std::is_nothrow_move_assignable, otherwise a deleted dummy assignment operator. | |
| constexpr auto | operator= (move_assign_arg &&other) noexcept -> result & |
Move-assignment for the case that value_type and error_type satisfy std::is_nothrow_move_constructible and std::is_nothrow_move_assignable, otherwise a dummy assignment operator that can never be called. | |
| constexpr auto | operator= (move_assign_arg &&other) noexcept -> result & |
Move-assignment for the case that error_type satisfies std::is_nothrow_move_constructible and std::is_nothrow_move_assignable, otherwise a dummy assignment operator that can never be called. | |
| template<typename SourceErrorType = E, constraints< std::enable_if_t< is_swappable_v< SourceErrorType > >, std::enable_if_t< std::is_nothrow_move_constructible< SourceErrorType >::value > > = nullptr> | |
| constexpr void | swap (result &other) noexcept(is_nothrow_swappable_v< SourceErrorType >) |
| Swaps the state of two results. | |
| constexpr void | swap (result &other) noexcept(is_nothrow_swappable_v< SourceValueType > &&is_nothrow_swappable_v< SourceErrorType >) |
| Swaps the state of two results. | |
| template<typename F> | |
| constexpr auto | transform_error (F &&handle_error) & |
| Calls a provided functor with the error channel if it is populated, and produces a new result with the return from it. | |
| template<typename F> | |
| constexpr auto | transform_error (F &&handle_error) && |
| Calls a provided functor with the error channel if it is populated, and produces a new result with the return from it. | |
| template<typename F> | |
| constexpr auto | transform_error (F &&handle_error) const & |
| Calls a provided functor with the error channel if it is populated, and produces a new result with the return from it. | |
| template<typename F> | |
| constexpr auto | transform_error (F &&handle_error) const && |
| Calls a provided functor with the error channel if it is populated, and produces a new result with the return from it. | |
| constexpr void | value () &&noexcept |
| Access the content of the value channel. | |
| ARENE_NODISCARD constexpr auto | value () &&noexcept -> value_type && |
| Accesses a reference to the content of the value channel. | |
| ARENE_NODISCARD constexpr auto | value () &noexcept -> value_type & |
| Accesses a reference to the content of the value channel. | |
| ARENE_NODISCARD constexpr auto | value () const &&noexcept -> value_type const && |
| Accesses a reference to the content of the value channel. | |
| constexpr void | value () const &noexcept |
| Access the content of the value channel. | |
| ARENE_NODISCARD constexpr auto | value () const &noexcept -> value_type const & |
| Accesses a reference to the content of the value channel. | |
| ARENE_NODISCARD constexpr auto | value_or (U &&default_value) &&noexcept -> value_type |
Returns the value if the value channel is populated, else another value. Not declared if T is void . | |
| ARENE_NODISCARD constexpr auto | value_or (U &&default_value) const &noexcept -> value_type |
Returns the value if the value channel is populated, else another value. Not declared if T is void . | |
| ARENE_NODISCARD constexpr auto | error () &noexcept -> error_type & |
| Accesses a reference to the content of the error channel. | |
| ARENE_NODISCARD constexpr auto | error () const &noexcept -> error_type const & |
| Accesses a reference to the content of the error channel. | |
| ARENE_NODISCARD constexpr auto | error () &&noexcept -> error_type && |
| Accesses a reference to the content of the error channel. | |
| ARENE_NODISCARD constexpr auto | error () const &&noexcept -> error_type const && |
| Accesses a reference to the content of the error channel. | |
| template<typename F> | |
| constexpr auto | and_then (F &&handle_value) & |
Monadic API which invokes a functor with the contents of value() if the value channel is populated. | |
| template<typename F> | |
| constexpr auto | and_then (F &&handle_value) const & |
Monadic API which invokes a functor with the contents of value() if the value channel is populated. | |
| template<typename F> | |
| constexpr auto | and_then (F &&handle_value) && |
Monadic API which invokes a functor with the contents of value() if the value channel is populated. | |
| template<typename F> | |
| constexpr auto | and_then (F &&handle_value) const && |
Monadic API which invokes a functor with the contents of value() if the value channel is populated. | |
| template<typename F> | |
| constexpr auto | or_else (F &&handle_error) & |
Monadic API which invokes a functor with the contents of error() if the error channel is populated. | |
| template<typename F> | |
| constexpr auto | or_else (F &&handle_error) const & |
Monadic API which invokes a functor with the contents of error() if the error channel is populated. | |
| template<typename F> | |
| constexpr auto | or_else (F &&handle_error) && |
Monadic API which invokes a functor with the contents of error() if the error channel is populated. | |
| template<typename F> | |
| constexpr auto | or_else (F &&handle_error) const && |
Monadic API which invokes a functor with the contents of error() if the error channel is populated. | |
| template<typename F> | |
| constexpr auto | transform (F &&handle_value) & |
| Calls a provided functor with the value channel if it is populated, and produces a new result with the return from it. | |
| template<typename F> | |
| constexpr auto | transform (F &&handle_value) const & |
| Calls a provided functor with the value channel if it is populated, and produces a new result with the return from it. | |
| template<typename F> | |
| constexpr auto | transform (F &&handle_value) && |
| Calls a provided functor with the value channel if it is populated, and produces a new result with the return from it. | |
| template<typename F> | |
| constexpr auto | transform (F &&handle_value) const && |
| Calls a provided functor with the value channel if it is populated, and produces a new result with the return from it. | |
| constexpr auto | and_then (F &&handle_value) & |
Monadic API which invokes a functor with the contents of value() if the value channel is populated. | |
| constexpr auto | and_then (F &&handle_value) const & |
Monadic API which invokes a functor with the contents of value() if the value channel is populated. | |
| constexpr auto | and_then (F &&handle_value) && |
Monadic API which invokes a functor with the contents of value() if the value channel is populated. | |
| constexpr auto | and_then (F &&handle_value) const && |
Monadic API which invokes a functor with the contents of value() if the value channel is populated. | |
| constexpr auto | or_else (F &&handle_error) & |
Monadic API which invokes a functor with the contents of error() if the error channel is populated. | |
| constexpr auto | or_else (F &&handle_error) const & |
Monadic API which invokes a functor with the contents of error() if the error channel is populated. | |
| constexpr auto | or_else (F &&handle_error) && |
Monadic API which invokes a functor with the contents of error() if the error channel is populated. | |
| constexpr auto | or_else (F &&handle_error) const && |
Monadic API which invokes a functor with the contents of error() if the error channel is populated. | |
| constexpr auto | transform (F &&handle_value) & |
| Calls a provided functor with the value channel if it is populated, and produces a new result with the return from it. | |
| constexpr auto | transform (F &&handle_value) const & |
| Calls a provided functor with the value channel if it is populated, and produces a new result with the return from it. | |
| constexpr auto | transform (F &&handle_value) && |
| Calls a provided functor with the value channel if it is populated, and produces a new result with the return from it. | |
| constexpr auto | transform (F &&handle_value) const && |
| Calls a provided functor with the value channel if it is populated, and produces a new result with the return from it. | |
| constexpr auto | transform_error (F &&handle_error) & |
| Calls a provided functor with the error channel if it is populated, and produces a new result with the return from it. | |
| constexpr auto | transform_error (F &&handle_error) const & |
| Calls a provided functor with the error channel if it is populated, and produces a new result with the return from it. | |
| constexpr auto | transform_error (F &&handle_error) && |
| Calls a provided functor with the error channel if it is populated, and produces a new result with the return from it. | |
| constexpr auto | transform_error (F &&handle_error) const && |
| Calls a provided functor with the error channel if it is populated, and produces a new result with the return from it. | |
Friends | |
| ARENE_NODISCARD friend constexpr auto | operator!= (result const &lhs, result const &rhs) noexcept(noexcept(lhs==rhs)) -> bool |
| Compare two results for inequality. | |
| ARENE_NODISCARD friend constexpr auto | operator!= (result const &lhs, result const &rhs) noexcept(noexcept(lhs==rhs)) -> bool |
| Compare two results for inequality. | |
| ARENE_NODISCARD friend constexpr auto | operator== (result const &lhs, result const &rhs) noexcept(noexcept(lhs.has_error(rhs.error()))) -> bool |
| Compare two results for equality. | |
| ARENE_NODISCARD friend constexpr auto | operator== (result const &lhs, result const &rhs) noexcept(noexcept(lhs.has_value(rhs.value())) &&noexcept(lhs.has_error(rhs.error()))) -> bool |
| Compare two results for equality. | |
| constexpr void | swap (result &lhs, result &rhs) noexcept(noexcept(lhs.swap(rhs))) |
| Swaps the state of two results. | |
| template<typename SourceErrorType = E, constraints< std::enable_if_t< is_swappable_v< SourceErrorType > >, std::enable_if_t< std::is_move_constructible< SourceErrorType >::value > > = nullptr> | |
| constexpr void | swap (result &lhs, result &rhs) noexcept(noexcept(lhs.swap(rhs))) |
| Swaps the state of two results. | |
Specialization of result<T, E> for void value types.
| E | The error type |
| using arene::base::result< void, E >::error_type |
The type when the result contains an error.
| using arene::base::result< void, E >::error_type = E |
The type when the result contains an error.
| using arene::base::result< void, E >::value_type |
The type when the result contains a value.
| using arene::base::result< void, E >::value_type = void |
The type when the result contains a value.
|
constexprdefault |
Constructs a result with the value-channel engaged.
has_value() returns true
|
inlineconstexprnoexcept |
Constructs a result with the value-channel engaged.
| P | The type of the initializers. Must satisfy std::is_constructible<value_type,P&&...> . |
has_value() returns true
|
inlineconstexprnoexcept |
Constructs a result with the value-channel engaged. Provided for backwards compatibility.
| P | The type of the initializers. Must satisfy std::is_constructible<value_type,P&&...> . |
has_value() returns true
|
inlineconstexprnoexcept |
Constructs a result containing the error_type by way of direct-non-list-initialization.
| P | The type of the initializers. Must satisfy std::is_constructible<error_type,P&&...> . |
| args | The arguments to initialize the value channel with. |
has_error() returns true error() returns reference to an object equivalent to constructing error_type with args .Example Usage:
|
constexprdefaultnoexcept |
Default copy constructor.
|
constexprdefaultnoexcept |
Default move constructor.
|
default |
Destroy the stored value or error.
|
constexprdefault |
Constructs a result with a default-constructed value_type . Does not participate in overload resolution if value_type is not default constructible.
has_value() returns true value() returns reference to an object equivalent to default-constructing value_type .
|
inlineconstexprnoexcept |
Constructs a result containing the value_type by way of direct-non-list-initialization.
| P | The type of the initializers. Must satisfy std::is_constructible<value_type,P&&...> . |
| args | The arguments to initialize the value channel with. |
has_value() returns true value() returns reference to an object equivalent to constructing value_type with args .Example Usage:
|
inlineconstexprnoexcept |
Constructs a result containing the error_type by way of direct-non-list-initialization.
| P | The type of the initializers. Must satisfy std::is_constructible<error_type,P&&...> . |
| args | The arguments to initialize the value channel with. |
has_error() returns true error() returns reference to an object equivalent to constructing error_type with args .Example Usage:
|
constexprdefaultnoexcept |
Default copy constructor.
|
constexprdefaultnoexcept |
Default move constructor.
|
default |
Destroy the stored value or error.
|
inlineconstexpr |
Monadic API which invokes a functor with the contents of value() if the value channel is populated.
| F | Type of the visiting functor. Must be invocable with value_type matching the const/ref qualification of SelfType, and return result<U,error_type> , where U may be any valid value_type . |
| handle_value | the functor to invoke if self.has_value() is true . |
handle_value with the contents of self.value() , or it will contain a copy of self.error() .Basic usage example for opening a file:
After this statement, maybe_file will contain either a valid instance of arene::base::file_handle in the value channel, or it will contain an instance of arene::base::error_code representing either the failure to open the file or the failure to open the directory.
|
inlineconstexpr |
Monadic API which invokes a functor with the contents of value() if the value channel is populated.
| F | Type of the visiting functor. Must be invocable with value_type matching the const/ref qualification of SelfType , or with no arguments if value_type is void , and return result<U,error_type> , where U may be any valid value_type . |
| handle_value | the functor to invoke if self.has_value() is true . |
handle_value with the contents of self.value() , or it will contain a copy of self.error() .Basic usage example for opening a file:
After this statement, maybe_file will contain either a valid instance of arene::base::file_handle in the value channel, or it will contain an instance of arene::base::error_code representing either the failure to open the file or the failure to open the directory.
|
inlineconstexpr |
Monadic API which invokes a functor with the contents of value() if the value channel is populated.
| F | Type of the visiting functor. Must be invocable with value_type matching the const/ref qualification of SelfType, and return result<U,error_type> , where U may be any valid value_type . |
| handle_value | the functor to invoke if self.has_value() is true . |
handle_value with the contents of self.value() , or it will contain a copy of self.error() .Basic usage example for opening a file:
After this statement, maybe_file will contain either a valid instance of arene::base::file_handle in the value channel, or it will contain an instance of arene::base::error_code representing either the failure to open the file or the failure to open the directory.
|
inlineconstexpr |
Monadic API which invokes a functor with the contents of value() if the value channel is populated.
| F | Type of the visiting functor. Must be invocable with value_type matching the const/ref qualification of SelfType , or with no arguments if value_type is void , and return result<U,error_type> , where U may be any valid value_type . |
| handle_value | the functor to invoke if self.has_value() is true . |
handle_value with the contents of self.value() , or it will contain a copy of self.error() .Basic usage example for opening a file:
After this statement, maybe_file will contain either a valid instance of arene::base::file_handle in the value channel, or it will contain an instance of arene::base::error_code representing either the failure to open the file or the failure to open the directory.
|
inlineconstexpr |
Monadic API which invokes a functor with the contents of value() if the value channel is populated.
| F | Type of the visiting functor. Must be invocable with value_type matching the const/ref qualification of SelfType, and return result<U,error_type> , where U may be any valid value_type . |
| handle_value | the functor to invoke if self.has_value() is true . |
handle_value with the contents of self.value() , or it will contain a copy of self.error() .Basic usage example for opening a file:
After this statement, maybe_file will contain either a valid instance of arene::base::file_handle in the value channel, or it will contain an instance of arene::base::error_code representing either the failure to open the file or the failure to open the directory.
|
inlineconstexpr |
Monadic API which invokes a functor with the contents of value() if the value channel is populated.
| F | Type of the visiting functor. Must be invocable with value_type matching the const/ref qualification of SelfType , or with no arguments if value_type is void , and return result<U,error_type> , where U may be any valid value_type . |
| handle_value | the functor to invoke if self.has_value() is true . |
handle_value with the contents of self.value() , or it will contain a copy of self.error() .Basic usage example for opening a file:
After this statement, maybe_file will contain either a valid instance of arene::base::file_handle in the value channel, or it will contain an instance of arene::base::error_code representing either the failure to open the file or the failure to open the directory.
|
inlineconstexpr |
Monadic API which invokes a functor with the contents of value() if the value channel is populated.
| F | Type of the visiting functor. Must be invocable with value_type matching the const/ref qualification of SelfType, and return result<U,error_type> , where U may be any valid value_type . |
| handle_value | the functor to invoke if self.has_value() is true . |
handle_value with the contents of self.value() , or it will contain a copy of self.error() .Basic usage example for opening a file:
After this statement, maybe_file will contain either a valid instance of arene::base::file_handle in the value channel, or it will contain an instance of arene::base::error_code representing either the failure to open the file or the failure to open the directory.
|
inlineconstexpr |
Monadic API which invokes a functor with the contents of value() if the value channel is populated.
| F | Type of the visiting functor. Must be invocable with value_type matching the const/ref qualification of SelfType , or with no arguments if value_type is void , and return result<U,error_type> , where U may be any valid value_type . |
| handle_value | the functor to invoke if self.has_value() is true . |
handle_value with the contents of self.value() , or it will contain a copy of self.error() .Basic usage example for opening a file:
After this statement, maybe_file will contain either a valid instance of arene::base::file_handle in the value channel, or it will contain an instance of arene::base::error_code representing either the failure to open the file or the failure to open the directory.
|
inlinenoexcept |
Emplaces the void value into the result.
has_value() returns true .
|
inlinenoexcept |
Emplaces a value into the result.
| ArgTypes | the types of the arguments to construct the value with |
| args | The arguments to construct the value with |
has_value() returns true value() will be equivalent to a value_type direct-initialized from args .
|
inlineconstexprnoexcept |
Accesses a reference to the content of the error channel.
|
inlineconstexprnoexcept |
Accesses a reference to the content of the error channel.
|
inlineconstexprnoexcept |
Accesses a reference to the content of the error channel.
|
inlineconstexprnoexcept |
Accesses a reference to the content of the error channel.
|
inlineconstexprnoexcept |
Accesses a reference to the content of the error channel.
|
inlineconstexprnoexcept |
Accesses a reference to the content of the error channel.
|
inlineconstexprnoexcept |
Accesses a reference to the content of the error channel.
|
inlineconstexprnoexcept |
Accesses a reference to the content of the error channel.
|
inlineconstexprnoexcept |
Checks if the value channel contains a specific value.
| val | The value to check for. |
has_value() and value()==val .
|
inlineconstexprnoexcept |
Accesses a reference to the content of the value channel.
|
inlineconstexprnoexcept |
Accesses a reference to the content of the value channel.
|
inlineconstexprnoexcept |
Accesses a reference to the content of the value channel.
|
inlineconstexprnoexcept |
Access the content of the value channel.
|
inlineconstexprnoexcept |
Accesses a reference to the content of the value channel.
|
inlineconstexprnoexcept |
Accesses a pointer to the content of the value channel.
|
inlineconstexprnoexcept |
Accesses a pointer to the content of the value channel.
|
inlineconstexprnoexcept |
Copy-assignment for the case that value_type and error_type satisfy std::is_nothrow_copy_constructible and std::is_nothrow_copy_assignable, otherwise a dummy assignment operator that can never be called.
| other | The value to copy from |
|
inlineconstexprnoexcept |
Copy-assignment for the case that error_type satisfies std::is_nothrow_copy_constructible and std::is_nothrow_copy_assignable, otherwise a dummy assignment operator that can never be called.
| other | The value to copy from |
|
constexprdeletenoexcept |
Deleted Copy-assignment if value_type or error_type do not satisfy std::is_nothrow_copy_constructible and std::is_nothrow_copy_assignable, otherwise a deleted dummy assignment operator.
| other | The value to copy from |
|
constexprdeletenoexcept |
Deleted Copy-assignment if error_type does not satisfy std::is_nothrow_copy_constructible and std::is_nothrow_copy_assignable, otherwise a deleted dummy assignment operator.
| other | The value to copy from |
|
constexprdeletenoexcept |
Deleted Move-assignment if value_type or error_type do not satisfy std::is_nothrow_move_constructible and std::is_nothrow_move_assignable, otherwise a deleted dummy assignment operator.
| other | The value to move from |
|
constexprdeletenoexcept |
Deleted Move-assignment if error_type does not satisfy std::is_nothrow_move_constructible and std::is_nothrow_move_assignable, otherwise a deleted dummy assignment operator.
| other | The value to move from |
|
inlineconstexprnoexcept |
Move-assignment for the case that value_type and error_type satisfy std::is_nothrow_move_constructible and std::is_nothrow_move_assignable, otherwise a dummy assignment operator that can never be called.
| other | The value to move from |
|
inlineconstexprnoexcept |
Move-assignment for the case that error_type satisfies std::is_nothrow_move_constructible and std::is_nothrow_move_assignable, otherwise a dummy assignment operator that can never be called.
| other | The value to move from |
|
inlineconstexpr |
Monadic API which invokes a functor with the contents of error() if the error channel is populated.
| F | Type of the visiting functor. Must be invocable with error_type matching the const/ref qualification of SelfType and return result<value_type,E> , where E may be any valid error_type . |
| handle_error | the functor to invoke if self.has_error() is true . |
handle_error with the contents of self.error() , or it will contain a copy of self.value() .Basic usage example for opening a directory:
|
inlineconstexpr |
Monadic API which invokes a functor with the contents of error() if the error channel is populated.
| F | Type of the visiting functor. Must be invocable with error_type matching the const/ref qualification of SelfType and return result<value_type,E> , where E may be any valid error_type . |
| handle_error | the functor to invoke if self.has_error() is true . |
handle_error with the contents of self.error() , or it will contain a copy of self.value() .Basic usage example for opening a directory:
After this statement, maybe_dir will contain either a valid instance of arene::base::directory_handle in the value channel, or it will have logged the error and contain the passed through error_code .
|
inlineconstexpr |
Monadic API which invokes a functor with the contents of error() if the error channel is populated.
| F | Type of the visiting functor. Must be invocable with error_type matching the const/ref qualification of SelfType and return result<value_type,E> , where E may be any valid error_type . |
| handle_error | the functor to invoke if self.has_error() is true . |
handle_error with the contents of self.error() , or it will contain a copy of self.value() .Basic usage example for opening a directory:
|
inlineconstexpr |
Monadic API which invokes a functor with the contents of error() if the error channel is populated.
| F | Type of the visiting functor. Must be invocable with error_type matching the const/ref qualification of SelfType and return result<value_type,E> , where E may be any valid error_type . |
| handle_error | the functor to invoke if self.has_error() is true . |
handle_error with the contents of self.error() , or it will contain a copy of self.value() .Basic usage example for opening a directory:
After this statement, maybe_dir will contain either a valid instance of arene::base::directory_handle in the value channel, or it will have logged the error and contain the passed through error_code .
|
inlineconstexpr |
Monadic API which invokes a functor with the contents of error() if the error channel is populated.
| F | Type of the visiting functor. Must be invocable with error_type matching the const/ref qualification of SelfType and return result<value_type,E> , where E may be any valid error_type . |
| handle_error | the functor to invoke if self.has_error() is true . |
handle_error with the contents of self.error() , or it will contain a copy of self.value() .Basic usage example for opening a directory:
|
inlineconstexpr |
Monadic API which invokes a functor with the contents of error() if the error channel is populated.
| F | Type of the visiting functor. Must be invocable with error_type matching the const/ref qualification of SelfType and return result<value_type,E> , where E may be any valid error_type . |
| handle_error | the functor to invoke if self.has_error() is true . |
handle_error with the contents of self.error() , or it will contain a copy of self.value() .Basic usage example for opening a directory:
After this statement, maybe_dir will contain either a valid instance of arene::base::directory_handle in the value channel, or it will have logged the error and contain the passed through error_code .
|
inlineconstexpr |
Monadic API which invokes a functor with the contents of error() if the error channel is populated.
| F | Type of the visiting functor. Must be invocable with error_type matching the const/ref qualification of SelfType and return result<value_type,E> , where E may be any valid error_type . |
| handle_error | the functor to invoke if self.has_error() is true . |
handle_error with the contents of self.error() , or it will contain a copy of self.value() .Basic usage example for opening a directory:
|
inlineconstexpr |
Monadic API which invokes a functor with the contents of error() if the error channel is populated.
| F | Type of the visiting functor. Must be invocable with error_type matching the const/ref qualification of SelfType and return result<value_type,E> , where E may be any valid error_type . |
| handle_error | the functor to invoke if self.has_error() is true . |
handle_error with the contents of self.error() , or it will contain a copy of self.value() .Basic usage example for opening a directory:
After this statement, maybe_dir will contain either a valid instance of arene::base::directory_handle in the value channel, or it will have logged the error and contain the passed through error_code .
|
inlineconstexprnoexcept |
Swaps the state of two results.
| SourceErrorType | Must satisfy is_swappable_v<error_type> and std::is_nothrow_move_constructable<error_type> |
| other | The result to swap with |
this and other have matching channels populated, the content of those channels are swapped as if via arene::base::swap . Otherwise, it is equivalent to emplacing this with the active channel from other , and vice-versa.
|
inlineconstexprnoexcept |
Swaps the state of two results.
| SourceValueType | Must satisfy is_swappable_v<SourceValueType> and std::is_nothrow_move_constructible<SourceValueType> |
| SourceErrorType | Must satisfy is_swappable_v<SourceErrorType> and std::is_nothrow_move_constructible<SourceErrorType> |
| other | The result to swap with |
this and other have matching channels populated, the content of those channels are swapped as if via arene::base::swap . Otherwise, it is equivalent to emplacing this with the active channel from other , and vice-versa.
|
inlineconstexpr |
Calls a provided functor with the value channel if it is populated, and produces a new result with the return from it.
| F | Type of the visiting functor. Must be invocable with value_type matching the const/ref qualification of this . May return any valid value_type |
| handle_value | the functor to invoke if has_value() is true . |
result<U,error_type> constructed from the result of invoking handle_value with the contents of value() if value_type is not void and the return from F is not void result<void,error_type> constructed from the result of invoking handle_value with the contents of value() if value_type is not void and the return from F is void result<U,error_type> where U is the return type of F constructed from a copy of error() .
|
inlineconstexpr |
Calls a provided functor with the value channel if it is populated, and produces a new result with the return from it.
| F | Type of the visiting functor. Must be invocable with value_type matching the const/ref qualification of this , or with no arguments if value_type is void . May return any valid value_type |
| handle_value | the functor to invoke if has_value() is true . |
result<U,error_type> constructed from the result of invoking handle_value if the return from F is not void result<void,error_type> constructed from the result of invoking handle_value if the return from F is void result<U,error_type> where U is the return type of F constructed from a copy of self.error() .
|
inlineconstexpr |
Calls a provided functor with the value channel if it is populated, and produces a new result with the return from it.
| F | Type of the visiting functor. Must be invocable with value_type matching the const/ref qualification of this . May return any valid value_type |
| handle_value | the functor to invoke if has_value() is true . |
result<U,error_type> constructed from the result of invoking handle_value with the contents of value() if value_type is not void and the return from F is not void result<void,error_type> constructed from the result of invoking handle_value with the contents of value() if value_type is not void and the return from F is void result<U,error_type> where U is the return type of F constructed from a copy of error() .
|
inlineconstexpr |
Calls a provided functor with the value channel if it is populated, and produces a new result with the return from it.
| F | Type of the visiting functor. Must be invocable with value_type matching the const/ref qualification of this , or with no arguments if value_type is void . May return any valid value_type |
| handle_value | the functor to invoke if has_value() is true . |
result<U,error_type> constructed from the result of invoking handle_value if the return from F is not void result<void,error_type> constructed from the result of invoking handle_value if the return from F is void result<U,error_type> where U is the return type of F constructed from a copy of self.error() .
|
inlineconstexpr |
Calls a provided functor with the value channel if it is populated, and produces a new result with the return from it.
| F | Type of the visiting functor. Must be invocable with value_type matching the const/ref qualification of this . May return any valid value_type |
| handle_value | the functor to invoke if has_value() is true . |
result<U,error_type> constructed from the result of invoking handle_value with the contents of value() if value_type is not void and the return from F is not void result<void,error_type> constructed from the result of invoking handle_value with the contents of value() if value_type is not void and the return from F is void result<U,error_type> where U is the return type of F constructed from a copy of error() .
|
inlineconstexpr |
Calls a provided functor with the value channel if it is populated, and produces a new result with the return from it.
| F | Type of the visiting functor. Must be invocable with value_type matching the const/ref qualification of this , or with no arguments if value_type is void . May return any valid value_type |
| handle_value | the functor to invoke if has_value() is true . |
result<U,error_type> constructed from the result of invoking handle_value if the return from F is not void result<void,error_type> constructed from the result of invoking handle_value if the return from F is void result<U,error_type> where U is the return type of F constructed from a copy of self.error() .
|
inlineconstexpr |
Calls a provided functor with the value channel if it is populated, and produces a new result with the return from it.
| F | Type of the visiting functor. Must be invocable with value_type matching the const/ref qualification of this . May return any valid value_type |
| handle_value | the functor to invoke if has_value() is true . |
result<U,error_type> constructed from the result of invoking handle_value with the contents of value() if value_type is not void and the return from F is not void result<void,error_type> constructed from the result of invoking handle_value with the contents of value() if value_type is not void and the return from F is void result<U,error_type> where U is the return type of F constructed from a copy of error() .
|
inlineconstexpr |
Calls a provided functor with the value channel if it is populated, and produces a new result with the return from it.
| F | Type of the visiting functor. Must be invocable with value_type matching the const/ref qualification of this , or with no arguments if value_type is void . May return any valid value_type |
| handle_value | the functor to invoke if has_value() is true . |
result<U,error_type> constructed from the result of invoking handle_value if the return from F is not void result<void,error_type> constructed from the result of invoking handle_value if the return from F is void result<U,error_type> where U is the return type of F constructed from a copy of self.error() .
|
inlineconstexpr |
Calls a provided functor with the error channel if it is populated, and produces a new result with the return from it.
| F | Type of the visiting functor. Must be invocable with error_type matching the const/ref qualification of this. May return any valid error_type . |
| handle_error | the functor to invoke if self.has_error() is true . |
handle_error with the contents of self.error() ,self.value() .
|
inlineconstexpr |
Calls a provided functor with the error channel if it is populated, and produces a new result with the return from it.
| F | Type of the visiting functor. Must be invocable with error_type matching the const/ref qualification of this. May return any valid error_type . |
| handle_error | the functor to invoke if self.has_error() is true . |
handle_error with the contents of self.error() ,self.value() . Basic usage example for opening a directory: After this statement, maybe_dir will contain either a valid instance of arene::base::directory_handle in the value channel, or it will have logged the error and contain the passed through error_code .
|
inlineconstexpr |
Calls a provided functor with the error channel if it is populated, and produces a new result with the return from it.
| F | Type of the visiting functor. Must be invocable with error_type matching the const/ref qualification of this. May return any valid error_type . |
| handle_error | the functor to invoke if self.has_error() is true . |
handle_error with the contents of self.error() ,self.value() .
|
inlineconstexpr |
Calls a provided functor with the error channel if it is populated, and produces a new result with the return from it.
| F | Type of the visiting functor. Must be invocable with error_type matching the const/ref qualification of this. May return any valid error_type . |
| handle_error | the functor to invoke if self.has_error() is true . |
handle_error with the contents of self.error() ,self.value() . Basic usage example for opening a directory: After this statement, maybe_dir will contain either a valid instance of arene::base::directory_handle in the value channel, or it will have logged the error and contain the passed through error_code .
|
inlineconstexpr |
Calls a provided functor with the error channel if it is populated, and produces a new result with the return from it.
| F | Type of the visiting functor. Must be invocable with error_type matching the const/ref qualification of this. May return any valid error_type . |
| handle_error | the functor to invoke if self.has_error() is true . |
handle_error with the contents of self.error() ,self.value() .
|
inlineconstexpr |
Calls a provided functor with the error channel if it is populated, and produces a new result with the return from it.
| F | Type of the visiting functor. Must be invocable with error_type matching the const/ref qualification of this. May return any valid error_type . |
| handle_error | the functor to invoke if self.has_error() is true . |
handle_error with the contents of self.error() ,self.value() . Basic usage example for opening a directory: After this statement, maybe_dir will contain either a valid instance of arene::base::directory_handle in the value channel, or it will have logged the error and contain the passed through error_code .
|
inlineconstexpr |
Calls a provided functor with the error channel if it is populated, and produces a new result with the return from it.
| F | Type of the visiting functor. Must be invocable with error_type matching the const/ref qualification of this. May return any valid error_type . |
| handle_error | the functor to invoke if self.has_error() is true . |
handle_error with the contents of self.error() ,self.value() .
|
inlineconstexpr |
Calls a provided functor with the error channel if it is populated, and produces a new result with the return from it.
| F | Type of the visiting functor. Must be invocable with error_type matching the const/ref qualification of this. May return any valid error_type . |
| handle_error | the functor to invoke if self.has_error() is true . |
handle_error with the contents of self.error() ,self.value() . Basic usage example for opening a directory: After this statement, maybe_dir will contain either a valid instance of arene::base::directory_handle in the value channel, or it will have logged the error and contain the passed through error_code .
|
inlineconstexprnoexcept |
Access the content of the value channel.
|
inlineconstexprnoexcept |
Accesses a reference to the content of the value channel.
|
inlineconstexprnoexcept |
Accesses a reference to the content of the value channel.
|
inlineconstexprnoexcept |
Accesses a reference to the content of the value channel.
|
inlineconstexprnoexcept |
Access the content of the value channel.
|
inlineconstexprnoexcept |
Accesses a reference to the content of the value channel.
|
inlineconstexprnoexcept |
Returns the value if the value channel is populated, else another value. Not declared if T is void .
| U | The type of the default value. Must satisfy std::is_convertible<U,value_type> . |
| default_value | The default value to use if the value channel is not populated. |
has_value() is true, equivalent to value() . Otherwise, default_value converted to value_type .
|
inlineconstexprnoexcept |
Returns the value if the value channel is populated, else another value. Not declared if T is void .
| U | The type of the default value. Must satisfy std::is_convertible<U,value_type> . |
| default_value | The default value to use if the value channel is not populated. |
has_value() is true, equivalent to value() . Otherwise, default_value converted to value_type .
|
friend |
Compare two results for inequality.
| lhs | The first result |
| rhs | The second result |
true if the both lhs and rhs hold values that are not equal, or both hold errors that are not equal, or one holds a value and the other holds an error, false otherwise
|
friend |
Compare two results for inequality.
| lhs | The first result |
| rhs | The second result |
true if the both lhs and rhs hold values that are not equal, or both hold errors that are not equal, or one holds a value and the other holds an error, false otherwise
|
friend |
Compare two results for equality.
| lhs | The first result |
| rhs | The second result |
true if the both lhs and rhs hold values that are equal, or both hold errors that are equal, false otherwise
|
friend |
Compare two results for equality.
| lhs | The first result |
| rhs | The second result |
true if the both lhs and rhs hold values that are equal, or both hold errors that are equal, false otherwise Swaps the state of two results.
| SourceValueType | Must satisfy is_swappable_v<SourceValueType> , std::is_nothrow_move_constructible<SourceValueType> |
| SourceErrorType | Must satisfy is_swappable_v<SourceErrorType> , std::is_nothrow_move_constructible<SourceErrorType> |
| lhs | The left hand result to swap |
| rhs | The right hand result to swap |
lhs and rhs have matching channels populated, the content of those channels are swapped as if via arene::base::swap . Otherwise, it is equivalent to emplacing lhs with the active channel from rhs , and vise-versa.
|
friend |
Swaps the state of two results.
| SourceErrorType | Must satisfy is_swappable_v<error_type> and std::is_nothrow_move_constructable<error_type> |
| lhs | The left hand result to swap |
| rhs | The right hand result to swap |
lhs and rhs have matching channels populated, the content of those channels are swapped as if via arene::base::swap . Otherwise, it is equivalent to move-assigning lhs with the active channel from rhs , and vise-versa.