no message
git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@35 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
parent
8c599321c7
commit
69936e7e81
27 changed files with 2073 additions and 495 deletions
34
tools/RegressionTest/Test_Singleton.cpp
Normal file
34
tools/RegressionTest/Test_Singleton.cpp
Normal file
|
@ -0,0 +1,34 @@
|
|||
#include <Loki\Singleton.h>
|
||||
|
||||
#include <iostream>
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
|
||||
using namespace ::Loki;
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
struct A { ~A(){} };
|
||||
struct B { ~B(){} };
|
||||
struct C { ~C(){} };
|
||||
|
||||
unsigned int GetLongevity(C*)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}//ns anon
|
||||
|
||||
extern void Test_Singleton()
|
||||
{
|
||||
cout << "Testing Loki\\Singleton" << endl;
|
||||
typedef SingletonHolder<A> SingletonHolder1_t;
|
||||
typedef SingletonHolder<B, CreateStatic> SingletonHolder2_t;
|
||||
typedef SingletonHolder<C, CreateUsingNew, SingletonWithLongevity> SingletonHolder3_t;
|
||||
|
||||
A& p = SingletonHolder1_t::Instance();
|
||||
SingletonHolder2_t::Instance();
|
||||
SingletonHolder3_t::Instance();
|
||||
cout << endl << endl;
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue