![]() |
Zen C++ Libraries
Zero-dependency re-usable components for C++
|
A type for computations that may fail. More...
#include <either.hpp>
Public Member Functions | |
| either (either &&other) | |
| either (const either &other) | |
| template<typename L2, typename R2> | |
| either (either< L2, R2 > &&other) | |
| template<typename L2, typename R2> | |
| either (const either< L2, R2 > &other) | |
| either< L, R > & | operator= (const either< L, R > &other) |
| either< L, R > & | operator= (either< L, R > &&other) |
| R * | operator-> () |
|
template<typename T = R> requires (!std::same_as<T, void>) | |
| T & | operator* () |
| bool | is_left () const |
| bool | is_right () const |
| operator bool () const | |
| R | unwrap () |
| R | unwrap () |
| L | unwrap_left () |
|
template<typename T = L> requires (!std::same_as<void, T>) | |
| T & | left () |
| Get a reference to the left-sided value of this either type. | |
|
template<typename T = R> requires (!std::same_as<T, void>) | |
| T & | right () |
| Get a reference to the right-sided value of this either type. | |
| L | take_left () && |
| R | take_right () && |
A type for computations that may fail.
|
inline |
Return whether this either type has a value on the left side.
If this method returns true, it is guaranteed that the either type does not have a value on the right side. Conversely, if this method returns false then it is guaranteed that the either type has a value on the right side.
|
inline |
Return whether this either type has a value on the right side.
If this method returns true, it is guaranteed that the either type does not have a value on the left side. Conversely, if this method returns false then it is guaranteed that the either type has a value on the left side.
|
inline |
Move the left-sided value out of this either type, destroying the either type in the processs.
|
inline |
Move the right-sided value out of this either type, destroying the either type in the processs.