LeechCraft  0.6.70-15082-g543737046d
Modular cross-platform feature rich live environment.
LC::Util::Either< L, R > Class Template Reference

#include "either.h"

Public Types

using L_t = L
 
using R_t = R
 

Public Member Functions

 Either ()=delete
 
 Either (const L &l)
 
 Either (const R &r)
 
 Either (const Either &)=default
 
 Either (Either &&)=default
 
Eitheroperator= (const Either &)=default
 
Eitheroperator= (Either &&)=default
 
bool IsLeft () const
 
bool IsRight () const
 
const L & GetLeft () const
 
const R & GetRight () const
 
std::optional< L > MaybeLeft () const
 
std::optional< R > MaybeRight () const
 
std::variant< L, R > AsVariant () const
 
template<typename F >
ToRight (F &&f) const
 

Static Public Member Functions

template<typename RNew >
static Either< L, RNew > FromMaybe (const std::optional< RNew > &maybeRight, const L &left)
 
static Either Left (const L &l)
 
static Either Right (const R &r)
 
template<typename... Vars>
static Either LeftLift (const std::variant< Vars... > &var)
 
template<typename... Vars>
static Either LeftLift (const Either< std::variant< Vars... >, R > &either)
 
template<typename LPrime , typename = std::enable_if_t<std::is_convertible_v<LPrime, L>>>
static Either LeftLift (const Either< LPrime, R > &either)
 
template<typename RNew >
static std::enable_if_t<!std::is_convertible< RNew, R >::value, Either< L, RNew > > Right (const RNew &r)
 
static auto EmbeddingLeft ()
 

Friends

bool operator== (const Either &e1, const Either &e2)
 
bool operator!= (const Either &e1, const Either &e2)
 

Detailed Description

template<typename L, typename R>
class LC::Util::Either< L, R >

Definition at line 33 of file either.h.

Member Typedef Documentation

◆ L_t

template<typename L , typename R >
using LC::Util::Either< L, R >::L_t = L

Definition at line 48 of file either.h.

◆ R_t

template<typename L , typename R >
using LC::Util::Either< L, R >::R_t = R

Definition at line 49 of file either.h.

Constructor & Destructor Documentation

◆ Either() [1/5]

template<typename L , typename R >
LC::Util::Either< L, R >::Either ( )
delete

◆ Either() [2/5]

template<typename L , typename R >
LC::Util::Either< L, R >::Either ( const L &  l)
inlineexplicit

Definition at line 53 of file either.h.

◆ Either() [3/5]

template<typename L , typename R >
LC::Util::Either< L, R >::Either ( const R &  r)
inlineexplicit

Definition at line 58 of file either.h.

◆ Either() [4/5]

template<typename L , typename R >
LC::Util::Either< L, R >::Either ( const Either< L, R > &  )
default

◆ Either() [5/5]

template<typename L , typename R >
LC::Util::Either< L, R >::Either ( Either< L, R > &&  )
default

Member Function Documentation

◆ AsVariant()

template<typename L , typename R >
std::variant<L, R> LC::Util::Either< L, R >::AsVariant ( ) const
inline

Definition at line 106 of file either.h.

◆ EmbeddingLeft()

template<typename L , typename R >
static auto LC::Util::Either< L, R >::EmbeddingLeft ( )
inlinestatic

Definition at line 165 of file either.h.

◆ FromMaybe()

template<typename L , typename R >
template<typename RNew >
static Either<L, RNew> LC::Util::Either< L, R >::FromMaybe ( const std::optional< RNew > &  maybeRight,
const L &  left 
)
inlinestatic

Definition at line 120 of file either.h.

◆ GetLeft()

template<typename L , typename R >
const L& LC::Util::Either< L, R >::GetLeft ( ) const
inline

Definition at line 78 of file either.h.

Referenced by LC::Util::InstanceMonad< std::optional< T > >::Bind(), and LC::Util::Either< L, R >::MaybeLeft().

+ Here is the caller graph for this function:

◆ GetRight()

template<typename L , typename R >
const R& LC::Util::Either< L, R >::GetRight ( ) const
inline

Definition at line 85 of file either.h.

Referenced by LC::Util::Either< L, R >::MaybeLeft().

+ Here is the caller graph for this function:

◆ IsLeft()

template<typename L , typename R >
bool LC::Util::Either< L, R >::IsLeft ( ) const
inline

Definition at line 68 of file either.h.

References LC::Util::Either< L, R >::IsRight().

Referenced by LC::Util::InstanceMonad< std::optional< T > >::Bind(), and LC::Util::Either< L, R >::IsRight().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsRight()

template<typename L , typename R >
bool LC::Util::Either< L, R >::IsRight ( ) const
inline

Definition at line 73 of file either.h.

References LC::Util::Either< L, R >::IsLeft().

Referenced by LC::Util::Either< L, R >::IsLeft(), LC::Util::Either< L, R >::Left(), and LC::Util::Either< L, R >::MaybeLeft().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Left()

template<typename L , typename R >
static Either LC::Util::Either< L, R >::Left ( const L &  l)
inlinestatic

Definition at line 127 of file either.h.

References LC::Util::Either< L, R >::IsRight(), LC::Util::Either< L, R >::LeftLift(), and LC::Util::Either< L, R >::Right().

Referenced by LC::Util::SerializeJsonToFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ LeftLift() [1/3]

template<typename L , typename R >
template<typename LPrime , typename = std::enable_if_t<std::is_convertible_v<LPrime, L>>>
static Either LC::Util::Either< L, R >::LeftLift ( const Either< LPrime, R > &  either)
inlinestatic

Definition at line 152 of file either.h.

◆ LeftLift() [2/3]

template<typename L , typename R >
template<typename... Vars>
static Either LC::Util::Either< L, R >::LeftLift ( const Either< std::variant< Vars... >, R > &  either)
inlinestatic

Definition at line 144 of file either.h.

◆ LeftLift() [3/3]

template<typename L , typename R >
template<typename... Vars>
static Either LC::Util::Either< L, R >::LeftLift ( const std::variant< Vars... > &  var)
inlinestatic

Definition at line 138 of file either.h.

Referenced by LC::Util::Either< L, R >::Left().

+ Here is the caller graph for this function:

◆ MaybeLeft()

template<typename L , typename R >
std::optional<L> LC::Util::Either< L, R >::MaybeLeft ( ) const
inline

Definition at line 92 of file either.h.

References LC::Util::oral::sph::f, LC::Util::Either< L, R >::GetLeft(), LC::Util::Either< L, R >::GetRight(), and LC::Util::Either< L, R >::IsRight().

+ Here is the call graph for this function:

◆ MaybeRight()

template<typename L , typename R >
std::optional<R> LC::Util::Either< L, R >::MaybeRight ( ) const
inline

Definition at line 99 of file either.h.

◆ operator=() [1/2]

template<typename L , typename R >
Either& LC::Util::Either< L, R >::operator= ( const Either< L, R > &  )
default

◆ operator=() [2/2]

template<typename L , typename R >
Either& LC::Util::Either< L, R >::operator= ( Either< L, R > &&  )
default

◆ Right() [1/2]

template<typename L , typename R >
static Either LC::Util::Either< L, R >::Right ( const R &  r)
inlinestatic

Definition at line 132 of file either.h.

Referenced by LC::Util::Either< L, R >::Left().

+ Here is the caller graph for this function:

◆ Right() [2/2]

template<typename L , typename R >
template<typename RNew >
static std::enable_if_t<!std::is_convertible<RNew, R>::value, Either<L, RNew> > LC::Util::Either< L, R >::Right ( const RNew &  r)
inlinestatic

Definition at line 160 of file either.h.

◆ ToRight()

template<typename L , typename R >
template<typename F >
R LC::Util::Either< L, R >::ToRight ( F &&  f) const
inline

Definition at line 112 of file either.h.

Friends And Related Function Documentation

◆ operator!=

template<typename L , typename R >
bool operator!= ( const Either< L, R > &  e1,
const Either< L, R > &  e2 
)
friend

Definition at line 182 of file either.h.

◆ operator==

template<typename L , typename R >
bool operator== ( const Either< L, R > &  e1,
const Either< L, R > &  e2 
)
friend

Definition at line 177 of file either.h.


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