Marjoram  0.01
Library for Functional Programming in C++
ma::detail::EitherImpl< Left_t, Right_t > Class Template Reference

Implementation of (safe) union of two types. More...

#include <eitherImpl.hpp>

Public Member Functions

template<typename... Args>
 EitherImpl (LeftSide, Args &&... args)
 Construct containing left type.
 
template<typename... Args>
 EitherImpl (RightSide, Args &&... args)
 Construct containing right type.
 
 ~EitherImpl ()
 Destructor, calling destructor of contained type.
 
 EitherImpl (const EitherImpl &rhs)
 Copy constructor; Copies underlying value.
 
 EitherImpl (EitherImpl &&rhs) noexcept
 Move constructor; Moves underlying value.
 
EitherImploperator= (const EitherImpl &rhs)
 Copy assignment operator; Copies underlying value.
 
EitherImploperator= (EitherImpl &&rhs) noexcept
 Move assignment operator; Moves underlying value.
 
Right_t & asRight ()
 Returns stored B value. More...
 
const Right_t & asRight () const
 Returns stored B value. More...
 
Left_t & asLeft ()
 Returns stored A value. More...
 
const Left_t & asLeft () const
 Returns stored A value. More...
 

Protected Attributes

EitherSide side
 Indicates whether this contains an A or a B.
 

Detailed Description

template<typename Left_t, typename Right_t>
class ma::detail::EitherImpl< Left_t, Right_t >

Implementation of (safe) union of two types.

Member Function Documentation

◆ asLeft() [1/2]

template<typename Left_t, typename Right_t>
Left_t& ma::detail::EitherImpl< Left_t, Right_t >::asLeft ( )
inline

Returns stored A value.

Undefined behavior if this either does not contain a A.

Returns
reference to stored value of type A.

◆ asLeft() [2/2]

template<typename Left_t, typename Right_t>
const Left_t& ma::detail::EitherImpl< Left_t, Right_t >::asLeft ( ) const
inline

Returns stored A value.

Undefined behavior if this either does not contain a A.

Returns
reference to stored value of type A.

◆ asRight() [1/2]

template<typename Left_t, typename Right_t>
Right_t& ma::detail::EitherImpl< Left_t, Right_t >::asRight ( )
inline

Returns stored B value.

Undefined behavior if this either does not contain a B.

Returns
reference to stored value of type B.

◆ asRight() [2/2]

template<typename Left_t, typename Right_t>
const Right_t& ma::detail::EitherImpl< Left_t, Right_t >::asRight ( ) const
inline

Returns stored B value.

Undefined behavior if this either does not contain a B.

Returns
reference to stored value of type B.

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