ultimatepp/uppdev/Union/Union.cpp
cxl 4a1c627474 Adding uppdev....
git-svn-id: svn://ultimatepp.org/upp/trunk@328 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2008-08-15 08:36:24 +00:00

34 lines
716 B
C++

#include <Core/Core.h>
#define Union NewUnion
template <class T>
int StaticTypeNo() {
static int typeno = -1;
if(typeno < 0)
typeno = RegisterTypeNo(typeid(T).name());
return typeno;
}
CONSOLE_APP_MAIN
{
Union test;
test.Create<String>();
test.Get<String>() = "ahoj";
test.Is<String>();
__BREAK__;
test.Is<String>();
__BREAK__;
DUMP(test.Is<String>());
DUMP(test.Is<int>());
DUMP(test.Get<String>());
DUMP((String)test);
DUMP(StaticTypeNo<int>());
DUMP(StaticTypeNo<Value>());
DUMP(StaticTypeNo<Stream>());
DUMP(StaticTypeNo<FileIn>());
DUMP(StaticTypeNo<int>());
DUMP(StaticTypeNo<Value>());
DUMP(StaticTypeNo<Stream>());
DUMP(StaticTypeNo<FileIn>());
}