VHISTlib  1.84.0.3018
Public Member Functions | Static Public Member Functions | Public Attributes
Maybe< T > Class Template Reference

Template class which may either hold a value of type T or nothing. More...

List of all members.

Public Member Functions

bool isNothing ()
 Checks if the object does not hold a value.
bool hasValue ()
 Checks if the object does hold a value.

Static Public Member Functions

static Maybe< T > just (const T &value)
 Creates a new Maybe object holding a value.
static Maybe< T > nothing ()
 Creates a new Maybe object holding nothing.

Public Attributes

value
 Contains the value held by the Maybe object.

Detailed Description

template<class T>
class Maybe< T >

Template class which may either hold a value of type T or nothing.

T must have a default constructor and be copyable.


Member Function Documentation

template<class T >
bool Maybe< T >::hasValue ( ) [inline]

Checks if the object does hold a value.

Returns:
true if the object does hold a value.
template<class T >
bool Maybe< T >::isNothing ( ) [inline]

Checks if the object does not hold a value.

Returns:
true if the object does not hold a value.
template<class T >
static Maybe<T> Maybe< T >::just ( const T &  value) [inline, static]

Creates a new Maybe object holding a value.

A copy of value will be created.

Parameters:
[in]valueThe value the object should hold.

Member Data Documentation

template<class T >
T Maybe< T >::value

Contains the value held by the Maybe object.

Use this member to access the object.


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

VHISTlib 1.84.0.3018 of Jun 28 2013, generated by doxygen.