Pretty Good Sum Type  1.0.0
Public Member Functions | Public Attributes | List of all members
pgs::recursive_union< T, Ts... > Struct Template Reference

Partial specialization. More...

#include <recursive_union.hpp>

Public Member Functions

 recursive_union ()
 Default ctor.
 
template<class... Args>
 recursive_union (constructor< T >, Args &&...args)
 Construct a T into v More...
 
template<class U , class... Args, pgs::enable_if_t< is_recursive_wrapper_containing< T, U >::value, int > = 0>
 recursive_union (constructor< U >, Args &&...args) noexcept(std::is_nothrow_constructible< U, Args... >::value)
 Construct (a recursive_wrapper<T>) into v More...
 
template<class U , class... Args, pgs::enable_if_t< and_< not_is_same< T, U > , not_is_recursive_wrapper_containing< T, U >>::value, int > = 0>
 recursive_union (constructor< U > t, Args &&...args) noexcept( std::is_nothrow_constructible< Ts..., constructor< U >, Args... >::value )
 Construct into r More...
 
 ~recursive_union ()
 Dtor.
 
void copy (std::size_t i, recursive_union const &u) noexcept( std::is_nothrow_copy_constructible< T >::value &&noexcept(std::declval< recursive_union >().r.copy(i-1, u.r)) )
 Copy. More...
 
void move (std::size_t i, recursive_union &&u) noexcept( std::is_nothrow_move_constructible< T >::value &&noexcept(std::declval< recursive_union >().r.move( i-1, std::move(u.r))) )
 Move. More...
 
void destruct (std::size_t i) noexcept(std::is_nothrow_destructible< T >::value &&noexcept(std::declval< recursive_union >().r.destruct(i-1)))
 Destruct. More...
 
bool compare (size_t i, recursive_union const &rhs) const noexcept
 Equality comparison. More...
 

Public Attributes

union pgs::recursive_union< T, Ts... >:: { ... }  
 An anonymous union. More...
 
v
 Value or...
 
recursive_union< Ts... > r
 ... recursive union
 

Detailed Description

template<class T, class... Ts>
struct pgs::recursive_union< T, Ts... >

Partial specialization.

Template Parameters
TType of v in the union
Tsrecursive_union<Ts...> is the type of r in the union

Constructor & Destructor Documentation

template<class T , class... Ts>
template<class... Args>
pgs::recursive_union< T, Ts... >::recursive_union ( constructor< T >  ,
Args &&...  args 
)
inlineexplicit

Construct a T into v

T and U are the same

template<class T , class... Ts>
template<class U , class... Args, pgs::enable_if_t< is_recursive_wrapper_containing< T, U >::value, int > = 0>
pgs::recursive_union< T, Ts... >::recursive_union ( constructor< U >  ,
Args &&...  args 
)
inlineexplicitnoexcept

Construct (a recursive_wrapper<T>) into v

T and U are different but T is a recursive wrapper and U is the type contained in T

template<class T , class... Ts>
template<class U , class... Args, pgs::enable_if_t< and_< not_is_same< T, U > , not_is_recursive_wrapper_containing< T, U >>::value, int > = 0>
pgs::recursive_union< T, Ts... >::recursive_union ( constructor< U >  t,
Args &&...  args 
)
inlineexplicitnoexcept

Construct into r

T and U are different and T is not a reference wrapper with U the type contained in T.

Member Function Documentation

template<class T , class... Ts>
bool pgs::recursive_union< T, Ts... >::compare ( size_t  i,
recursive_union< T, Ts... > const &  rhs 
) const
inlinenoexcept

Equality comparison.

If i is $0$ then compare v against rhs.v else, recursively invoke compare on r and a decremented i.

Parameters
iWhen zero, indicates the LHS object of the comparision
rhsThe value to compare the LHS against
template<class T , class... Ts>
void pgs::recursive_union< T, Ts... >::copy ( std::size_t  i,
recursive_union< T, Ts... > const &  u 
)
inlinenoexcept

Copy.

If i is $0$ then emplace copy-construct v from u.v else, recursively invoke copy on r and a decremented i.

Parameters
iWhen zero, the destination of the copy
uSource of the copy
template<class T , class... Ts>
void pgs::recursive_union< T, Ts... >::destruct ( std::size_t  i)
inlinenoexcept

Destruct.

If i is $0$ then destruct v else, recursively invoke destruct on r and a decremented i.

Parameters
iWhen zero, the destination of the destruction
template<class T , class... Ts>
void pgs::recursive_union< T, Ts... >::move ( std::size_t  i,
recursive_union< T, Ts... > &&  u 
)
inlinenoexcept

Move.

If i is $0$ then emplace move-construct v from u.v else, recursively invoke move on r and a decremented i.

Parameters
iWhen zero, the destination of the move
uSource of the move

Member Data Documentation

union { ... }

An anonymous union.

An anonymous union consisting of a field v of type T and a field r of type recursive_union<Ts...>


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