LeechCraft  0.6.70-10870-g558588d6ec
Modular cross-platform feature rich live environment.
LeechCraft::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)
 
template<typename LPrime , typename RPrime , typename = std::enable_if_t<std::is_convertible<LPrime, L>::value && std::is_convertible<RPrime, R>::value>>
 Either (const Either< LPrime, RPrime > &other)
 
 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
 
boost::optional< L > MaybeLeft () const
 
boost::optional< R > MaybeRight () const
 
boost::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 boost::optional< RNew > &maybeRight, const L &left)
 
static Either Left (const L &l)
 
static Either Right (const R &r)
 
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 LeechCraft::Util::Either< L, R >

Definition at line 44 of file either.h.

Member Typedef Documentation

◆ L_t

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

Definition at line 53 of file either.h.

◆ R_t

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

Definition at line 54 of file either.h.

Constructor & Destructor Documentation

◆ Either() [1/6]

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

◆ Either() [2/6]

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

Definition at line 58 of file either.h.

◆ Either() [3/6]

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

Definition at line 63 of file either.h.

◆ Either() [4/6]

template<typename L, typename R>
template<typename LPrime , typename RPrime , typename = std::enable_if_t<std::is_convertible<LPrime, L>::value && std::is_convertible<RPrime, R>::value>>
LeechCraft::Util::Either< L, R >::Either ( const Either< LPrime, RPrime > &  other)
inline

Definition at line 71 of file either.h.

References LeechCraft::Util::Either< L, R >::AsVariant().

+ Here is the call graph for this function:

◆ Either() [5/6]

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

◆ Either() [6/6]

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

Member Function Documentation

◆ AsVariant()

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

Definition at line 119 of file either.h.

Referenced by LeechCraft::Util::Either< L, R >::Either(), and LeechCraft::Util::Visit().

+ Here is the caller graph for this function:

◆ EmbeddingLeft()

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

Definition at line 156 of file either.h.

References LeechCraft::Util::Either< L, R >::Left().

+ Here is the call graph for this function:

◆ FromMaybe()

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

Definition at line 133 of file either.h.

References LeechCraft::Util::Either< L, R >::Left(), and LeechCraft::Util::Either< L, R >::Right().

+ Here is the call graph for this function:

◆ GetLeft()

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

◆ GetRight()

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

◆ IsLeft()

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

◆ IsRight()

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

◆ Left()

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

Definition at line 140 of file either.h.

Referenced by LeechCraft::Util::Either< L, R >::EmbeddingLeft(), and LeechCraft::Util::Either< L, R >::FromMaybe().

+ Here is the caller graph for this function:

◆ MaybeLeft()

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

Definition at line 105 of file either.h.

References LeechCraft::Util::Either< L, R >::GetLeft(), and LeechCraft::Util::Either< L, R >::IsLeft().

+ Here is the call graph for this function:

◆ MaybeRight()

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

Definition at line 112 of file either.h.

References LeechCraft::Util::Either< L, R >::GetRight(), and LeechCraft::Util::Either< L, R >::IsRight().

+ Here is the call graph for this function:

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ Right() [1/2]

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

◆ 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> > LeechCraft::Util::Either< L, R >::Right ( const RNew &  r)
inlinestatic

Definition at line 151 of file either.h.

References LeechCraft::Util::Either< L, R >::Right().

+ Here is the call graph for this function:

◆ ToRight()

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

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 173 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 168 of file either.h.


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