added a test

This commit is contained in:
LPTK 2013-06-12 15:45:10 +02:00
commit eaa3960373

27
eo/test/t-eoOptional.cpp Normal file
View file

@ -0,0 +1,27 @@
//-----------------------------------------------------------------------------
// t-eoOptional.cpp
//-----------------------------------------------------------------------------
#include "eoOptional.h"
//-----------------------------------------------------------------------------
typedef T int;
struct MyClass {
MyClass(eoOptional<T> my_T = NULL)
: actual_T(my_T.getOr(default_T))
{ }
private:
T default_T;
T& actual_T;
};
int main(int ac, char** av)
{
// Three ways of using MyClass:
MyClass mc1;
MyClass mc2(NULL);
T t;
MyClass mc3(t);
}