Zen C++ Libraries
Zero-dependency re-usable components for C++
Loading...
Searching...
No Matches
either< L, R > Class Template Reference

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
unwrap ()
unwrap ()
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.
take_left () &&
take_right () &&

Detailed Description

template<typename L, typename R>
class either< L, R >

A type for computations that may fail.

Member Function Documentation

◆ is_left()

template<typename L, typename R>
bool either< L, R >::is_left ( ) const
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.

◆ is_right()

template<typename L, typename R>
bool either< L, R >::is_right ( ) const
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.

◆ take_left()

template<typename L, typename R>
L either< L, R >::take_left ( ) &&
inline

Move the left-sided value out of this either type, destroying the either type in the processs.

◆ take_right()

template<typename L, typename R>
R either< L, R >::take_right ( ) &&
inline

Move the right-sided value out of this either type, destroying the either type in the processs.


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