VHISTlib
1.84.0.3018
|
Template class which may either hold a value of type T or nothing. More...
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 | |
T | value |
Contains the value held by the Maybe object. |
Template class which may either hold a value of type T or nothing.
T must have a default constructor and be copyable.
bool Maybe< T >::hasValue | ( | ) | [inline] |
Checks if the object does hold a value.
true
if the object does hold a value. bool Maybe< T >::isNothing | ( | ) | [inline] |
Checks if the object does not hold a value.
true
if the object does not hold a value. Creates a new Maybe object holding a value.
A copy of value will be created.
[in] | value | The value the object should hold. |
Contains the value held by the Maybe object.
Use this member to access the object.