LRDE Tiger Compiler  1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
misc::variant< T0, T1 > Class Template Reference

#include <variant.hh>

Inheritance diagram for misc::variant< T0, T1 >:
Collaboration diagram for misc::variant< T0, T1 >:

Public Types

typedef variant< T0, T1 > self_type
 The type of this variant.
typedef boost::variant< T0, T1 > super_type
 Super type.

Public Member Functions

template<typename U >
self_typeoperator= (const U &)
 variant ()
template<typename U >
 variant (const U &rhs)
 operator T0 & ()
 Convert this variant to a value of type U.
 operator T1 & ()
 operator const T0 & () const
 operator const T1 & () const

Detailed Description

template<typename T0, typename T1>
class misc::variant< T0, T1 >

A wrapper over boost::variant (with two types) supporting conversion operators.

Preconditions:

  • Each type must be unique.
  • No type may be const-qualified.

Proper declaration form: misc::variant<T0, T1>

Member Typedef Documentation

template<typename T0, typename T1>
typedef variant<T0, T1> misc::variant< T0, T1 >::self_type

The type of this variant.

template<typename T0, typename T1>
typedef boost::variant<T0, T1> misc::variant< T0, T1 >::super_type

Super type.

Constructor & Destructor Documentation

template<typename T0 , typename T1 >
misc::variant< T0, T1 >::variant ( )

Constructors.

template<typename T0 , typename T1 >
template<typename U >
misc::variant< T0, T1 >::variant ( const U &  rhs)

Member Function Documentation

template<typename T0 , typename T1 >
misc::variant< T0, T1 >::operator const T0 & ( ) const

Likewise, const version.

template<typename T0, typename T1>
misc::variant< T0, T1 >::operator const T1 & ( ) const
template<typename T0 , typename T1 >
misc::variant< T0, T1 >::operator T0 & ( )

Convert this variant to a value of type U.

This conversion rely on boost::get. In particular, if the conversion fails, a boost::bad_get exception is thrown.

template<typename T0, typename T1>
misc::variant< T0, T1 >::operator T1 & ( )
template<typename T0 , typename T1 >
template<typename U >
variant< T0, T1 > & misc::variant< T0, T1 >::operator= ( const U &  rhs)

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