Pretty Good Sum Type  1.0.0
Public Member Functions | Friends | List of all members
pgs::sum_type< Ts > Class Template Reference

A type modeling "sums with constructors" as used in functional programming. More...

#include <sum_type.hpp>

Public Member Functions

template<class T , class... Args>
 sum_type (constructor< T > t, Args &&...args)
 Ctor.
 
 sum_type (sum_type const &other)
 Copy ctor.
 
 sum_type (sum_type &&other)
 Move ctor.
 
 ~sum_type ()
 Dtor.
 
sum_typeoperator= (sum_type const &other)
 Copy-assign operator.
 
sum_typeoperator= (sum_type &&other)
 Move-assign operator.
 
template<class R , class... Fs>
match (Fs &&...fs) const
 match function, const overoad
 
template<class R , class... Fs>
match (Fs &&...fs)
 match function, non-const overoad
 
template<class... Fs>
void match (Fs &&...fs) const
 match procedure, const overoad
 
template<class... Fs>
void match (Fs &&...fs)
 match procedure, non-const overoad
 
template<class T >
constexpr bool is () const noexcept
 The currently active v is a T?
 
template<std::size_t I>
constexpr bool is_type_at () const noexcept
 The currently active v is at position I?
 

Friends

struct detail::sum_type_accessor
 
template<std::size_t I, class... Us>
struct detail::get_sum_type_element
 

Detailed Description

template<class... Ts>
class pgs::sum_type< Ts >

A type modeling "sums with constructors" as used in functional programming.

Examples:
array.t.cpp, expression.t.cpp, fibonacci.t.cpp, list.t.cpp, option.t.cpp, sexpr.t.cpp, and tree.t.cpp.

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