replace tabs with 4 spaces
git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@681 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
parent
30f4e933c1
commit
fd6b9484ee
16 changed files with 210 additions and 210 deletions
|
@ -17,10 +17,10 @@
|
||||||
//***********************************************************
|
//***********************************************************
|
||||||
//#include <boost/test/minimal.hpp>
|
//#include <boost/test/minimal.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#define BOOST_CHECK(exp) \
|
#define BOOST_CHECK(exp) \
|
||||||
( (exp) \
|
( (exp) \
|
||||||
? static_cast<void>(0) \
|
? static_cast<void>(0) \
|
||||||
: report_error(#exp,__FILE__,__LINE__) )
|
: report_error(#exp,__FILE__,__LINE__) )
|
||||||
|
|
||||||
#define BOOST_ERROR(x) std::cout << x << "\n"
|
#define BOOST_ERROR(x) std::cout << x << "\n"
|
||||||
inline void
|
inline void
|
||||||
|
@ -39,16 +39,16 @@ report_error( const char* msg, const char* file, int line, bool is_msg = false )
|
||||||
|
|
||||||
#define TEST_LOKI_FUNCTION
|
#define TEST_LOKI_FUNCTION
|
||||||
#ifndef TEST_LOKI_FUNCTION
|
#ifndef TEST_LOKI_FUNCTION
|
||||||
#include <boost/function.hpp>
|
#include <boost/function.hpp>
|
||||||
using namespace boost;
|
using namespace boost;
|
||||||
#else
|
#else
|
||||||
#define BOOST_FUNCTION_TARGET_FIX(x) x
|
#define BOOST_FUNCTION_TARGET_FIX(x) x
|
||||||
#define LOKI_CLASS_LEVEL_THREADING
|
#define LOKI_CLASS_LEVEL_THREADING
|
||||||
// disable to see "static instantiation order fiasco" crash
|
// disable to see "static instantiation order fiasco" crash
|
||||||
#define LOKI_FUNCTOR_IS_NOT_A_SMALLOBJECT
|
#define LOKI_FUNCTOR_IS_NOT_A_SMALLOBJECT
|
||||||
#include <loki/Function.h>
|
#include <loki/Function.h>
|
||||||
using namespace Loki;
|
using namespace Loki;
|
||||||
#define function Function
|
#define function Function
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -739,7 +739,7 @@ static void test_ref()
|
||||||
catch(runtime_error e)
|
catch(runtime_error e)
|
||||||
{
|
{
|
||||||
#ifndef TEST_LOKI_FUNCTION
|
#ifndef TEST_LOKI_FUNCTION
|
||||||
BOOST_ERROR("Nonthrowing constructor threw an exception");
|
BOOST_ERROR("Nonthrowing constructor threw an exception");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -809,6 +809,6 @@ int main()
|
||||||
#else // #ifndef LOKI_FUNCTORS_ARE_COMPARABLE
|
#else // #ifndef LOKI_FUNCTORS_ARE_COMPARABLE
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -275,16 +275,16 @@ void test_more()
|
||||||
Loki::Printf("\n\nMore tests:\n");
|
Loki::Printf("\n\nMore tests:\n");
|
||||||
|
|
||||||
Loki::Printf("\nCreating Pimpls\n");
|
Loki::Printf("\nCreating Pimpls\n");
|
||||||
P1* p1 = new P1;
|
P1* p1 = new P1;
|
||||||
P2* p2 = new P2;
|
P2* p2 = new P2;
|
||||||
P3* p3 = new P3;
|
P3* p3 = new P3;
|
||||||
P4* p4 = new P4;
|
P4* p4 = new P4;
|
||||||
P5* p5 = new P5;
|
P5* p5 = new P5;
|
||||||
PO1* p6 = new PO1;
|
PO1* p6 = new PO1;
|
||||||
PO2* p7 = new PO2;
|
PO2* p7 = new PO2;
|
||||||
PO3* p8 = new PO3;
|
PO3* p8 = new PO3;
|
||||||
PO4* p9 = new PO4;
|
PO4* p9 = new PO4;
|
||||||
PO5* p10 = new PO5;
|
PO5* p10 = new PO5;
|
||||||
|
|
||||||
Loki::Printf("\nConst check\n");
|
Loki::Printf("\nConst check\n");
|
||||||
p1->f();
|
p1->f();
|
||||||
|
@ -292,11 +292,11 @@ void test_more()
|
||||||
p3->f();
|
p3->f();
|
||||||
p4->f();
|
p4->f();
|
||||||
p5->f();
|
p5->f();
|
||||||
p6->f();
|
p6->f();
|
||||||
p7->f();
|
p7->f();
|
||||||
p8->f();
|
p8->f();
|
||||||
p9->f();
|
p9->f();
|
||||||
p10->f();
|
p10->f();
|
||||||
|
|
||||||
Loki::Printf("\nDeleting Pimpls\n");
|
Loki::Printf("\nDeleting Pimpls\n");
|
||||||
delete p1;
|
delete p1;
|
||||||
|
@ -305,10 +305,10 @@ void test_more()
|
||||||
delete p4;
|
delete p4;
|
||||||
delete p5;
|
delete p5;
|
||||||
delete p6;
|
delete p6;
|
||||||
delete p7;
|
delete p7;
|
||||||
delete p8;
|
delete p8;
|
||||||
delete p9;
|
delete p9;
|
||||||
delete p10;
|
delete p10;
|
||||||
|
|
||||||
|
|
||||||
Loki::Printf("\nCreating Rimpls\n");
|
Loki::Printf("\nCreating Rimpls\n");
|
||||||
|
@ -318,22 +318,22 @@ void test_more()
|
||||||
R4* r4 = new R4;
|
R4* r4 = new R4;
|
||||||
R5* r5 = new R5;
|
R5* r5 = new R5;
|
||||||
|
|
||||||
RO1* r6 = new RO1;
|
RO1* r6 = new RO1;
|
||||||
RO2* r7 = new RO2;
|
RO2* r7 = new RO2;
|
||||||
RO3* r8 = new RO3;
|
RO3* r8 = new RO3;
|
||||||
RO4* r9 = new RO4;
|
RO4* r9 = new RO4;
|
||||||
RO5* r10 = new RO5;
|
RO5* r10 = new RO5;
|
||||||
|
|
||||||
r1->f();
|
r1->f();
|
||||||
r2->f();
|
r2->f();
|
||||||
r3->f();
|
r3->f();
|
||||||
r4->f();
|
r4->f();
|
||||||
r5->f();
|
r5->f();
|
||||||
r6->f();
|
r6->f();
|
||||||
r7->f();
|
r7->f();
|
||||||
r8->f();
|
r8->f();
|
||||||
r9->f();
|
r9->f();
|
||||||
r10->f();
|
r10->f();
|
||||||
|
|
||||||
Loki::Printf("\nDeleting Rimpls\n");
|
Loki::Printf("\nDeleting Rimpls\n");
|
||||||
delete r1;
|
delete r1;
|
||||||
|
@ -342,10 +342,10 @@ void test_more()
|
||||||
delete r4;
|
delete r4;
|
||||||
delete r5;
|
delete r5;
|
||||||
delete r6;
|
delete r6;
|
||||||
delete r7;
|
delete r7;
|
||||||
delete r8;
|
delete r8;
|
||||||
delete r9;
|
delete r9;
|
||||||
delete r10;
|
delete r10;
|
||||||
|
|
||||||
|
|
||||||
Loki::Printf("\nCreating const Pimpls\n");
|
Loki::Printf("\nCreating const Pimpls\n");
|
||||||
|
@ -356,10 +356,10 @@ void test_more()
|
||||||
const P5* cp5 = new P5;
|
const P5* cp5 = new P5;
|
||||||
|
|
||||||
const PO1* cp6 = new PO1;
|
const PO1* cp6 = new PO1;
|
||||||
const PO2* cp7 = new PO2;
|
const PO2* cp7 = new PO2;
|
||||||
const PO3* cp8 = new PO3;
|
const PO3* cp8 = new PO3;
|
||||||
const PO4* cp9 = new PO4;
|
const PO4* cp9 = new PO4;
|
||||||
const PO5* cp10 = new PO5;
|
const PO5* cp10 = new PO5;
|
||||||
|
|
||||||
Loki::Printf("\nConst check\n");
|
Loki::Printf("\nConst check\n");
|
||||||
cp1->f();
|
cp1->f();
|
||||||
|
@ -368,10 +368,10 @@ void test_more()
|
||||||
cp4->f();
|
cp4->f();
|
||||||
cp5->f();
|
cp5->f();
|
||||||
cp6->f();
|
cp6->f();
|
||||||
cp7->f();
|
cp7->f();
|
||||||
cp8->f();
|
cp8->f();
|
||||||
cp9->f();
|
cp9->f();
|
||||||
cp10->f();
|
cp10->f();
|
||||||
|
|
||||||
Loki::Printf("\nDeleting const Pimpls\n");
|
Loki::Printf("\nDeleting const Pimpls\n");
|
||||||
delete cp1;
|
delete cp1;
|
||||||
|
@ -379,9 +379,9 @@ void test_more()
|
||||||
delete cp3;
|
delete cp3;
|
||||||
delete cp4;
|
delete cp4;
|
||||||
delete cp5;
|
delete cp5;
|
||||||
delete cp6;
|
delete cp6;
|
||||||
delete cp7;
|
delete cp7;
|
||||||
delete cp8;
|
delete cp8;
|
||||||
delete cp9;
|
delete cp9;
|
||||||
delete cp10;
|
delete cp10;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ public:
|
||||||
void foo();
|
void foo();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PimplT<A>::Type d;
|
PimplT<A>::Type d;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -102,11 +102,11 @@ typedef std::auto_ptr<ImplT<E> > StdAutoPtr;
|
||||||
|
|
||||||
// Pimpl
|
// Pimpl
|
||||||
|
|
||||||
typedef Pimpl<ImplT<E> > Pimpl1;
|
typedef Pimpl<ImplT<E> > Pimpl1;
|
||||||
typedef Pimpl<ImplT<E>, CPropPtr> Pimpl2;
|
typedef Pimpl<ImplT<E>, CPropPtr> Pimpl2;
|
||||||
typedef Pimpl<ImplT<E>, LokiPtr> Pimpl3;
|
typedef Pimpl<ImplT<E>, LokiPtr> Pimpl3;
|
||||||
typedef Pimpl<ImplT<E>, BoostPtr> Pimpl4;
|
typedef Pimpl<ImplT<E>, BoostPtr> Pimpl4;
|
||||||
typedef Pimpl<ImplT<E>, StdAutoPtr> Pimpl5;
|
typedef Pimpl<ImplT<E>, StdAutoPtr> Pimpl5;
|
||||||
|
|
||||||
struct P1 {Pimpl1 d; P1();void f();void f()const;};
|
struct P1 {Pimpl1 d; P1();void f();void f()const;};
|
||||||
struct P2 {Pimpl2 d; P2();void f();void f()const;};
|
struct P2 {Pimpl2 d; P2();void f();void f()const;};
|
||||||
|
@ -117,10 +117,10 @@ struct P5 {Pimpl5 d; P5();void f();void f()const;};
|
||||||
|
|
||||||
// PimplOwner
|
// PimplOwner
|
||||||
|
|
||||||
typedef PimplOwner<ImplT<E> > PimplOwner1;
|
typedef PimplOwner<ImplT<E> > PimplOwner1;
|
||||||
typedef PimplOwner<ImplT<E>, CPropPtr> PimplOwner2;
|
typedef PimplOwner<ImplT<E>, CPropPtr> PimplOwner2;
|
||||||
typedef PimplOwner<ImplT<E>, LokiPtr> PimplOwner3;
|
typedef PimplOwner<ImplT<E>, LokiPtr> PimplOwner3;
|
||||||
typedef PimplOwner<ImplT<E>, BoostPtr> PimplOwner4;
|
typedef PimplOwner<ImplT<E>, BoostPtr> PimplOwner4;
|
||||||
typedef PimplOwner<ImplT<E>, StdAutoPtr>PimplOwner5;
|
typedef PimplOwner<ImplT<E>, StdAutoPtr>PimplOwner5;
|
||||||
|
|
||||||
struct PO1 : private PimplOwner1 {PO1();void f();void f()const;};
|
struct PO1 : private PimplOwner1 {PO1();void f();void f()const;};
|
||||||
|
|
|
@ -30,7 +30,7 @@ public:
|
||||||
void foo();
|
void foo();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PimplT<A2>::Type d;
|
PimplT<A2>::Type d;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ public:
|
||||||
Incomplete1();
|
Incomplete1();
|
||||||
void foo();
|
void foo();
|
||||||
private:
|
private:
|
||||||
PimplT<Incomplete1>::Type d;
|
PimplT<Incomplete1>::Type d;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Incomplete2
|
class Incomplete2
|
||||||
|
@ -97,7 +97,7 @@ public:
|
||||||
~Incomplete2();
|
~Incomplete2();
|
||||||
void foo();
|
void foo();
|
||||||
private:
|
private:
|
||||||
PimplT<Incomplete2>::Type d;
|
PimplT<Incomplete2>::Type d;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ public:
|
||||||
}
|
}
|
||||||
void foo();
|
void foo();
|
||||||
private:
|
private:
|
||||||
PimplT<Incomplete3>::Type d;
|
PimplT<Incomplete3>::Type d;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -130,5 +130,5 @@ public:
|
||||||
Incomplete4();
|
Incomplete4();
|
||||||
void foo();
|
void foo();
|
||||||
private:
|
private:
|
||||||
Pimpl<Impl4, std::auto_ptr<Impl4> > d;
|
Pimpl<Impl4, std::auto_ptr<Impl4> > d;
|
||||||
};
|
};
|
||||||
|
|
|
@ -21,16 +21,16 @@
|
||||||
|
|
||||||
struct Base
|
struct Base
|
||||||
{
|
{
|
||||||
virtual void foo() = 0;
|
virtual void foo() = 0;
|
||||||
virtual ~Base();
|
virtual ~Base();
|
||||||
};
|
};
|
||||||
|
|
||||||
bool registerClass(std::string, Base*(*)() );
|
bool registerClass(std::string, Base*(*)() );
|
||||||
|
|
||||||
typedef Loki::Seq
|
typedef Loki::Seq
|
||||||
<
|
<
|
||||||
struct Foo,
|
struct Foo,
|
||||||
struct Boo
|
struct Boo
|
||||||
|
|
||||||
>::Type ClassList;
|
>::Type ClassList;
|
||||||
|
|
||||||
|
|
|
@ -43,25 +43,25 @@ Base* createBoo(){ return new Boo; }
|
||||||
|
|
||||||
namespace Loki
|
namespace Loki
|
||||||
{
|
{
|
||||||
template<> bool RegisterFunction<Foo>()
|
template<> bool RegisterFunction<Foo>()
|
||||||
{
|
{
|
||||||
std::cout << "RegisterFunction<Foo>\n";
|
std::cout << "RegisterFunction<Foo>\n";
|
||||||
return registerClass("Foo", &createFoo);
|
return registerClass("Foo", &createFoo);
|
||||||
}
|
}
|
||||||
template<> bool RegisterFunction<Boo>()
|
template<> bool RegisterFunction<Boo>()
|
||||||
{
|
{
|
||||||
std::cout << "RegisterFunction<Boo>\n";
|
std::cout << "RegisterFunction<Boo>\n";
|
||||||
return registerClass("Boo", &createBoo);
|
return registerClass("Boo", &createBoo);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<> bool UnRegisterFunction<Foo>()
|
template<> bool UnRegisterFunction<Foo>()
|
||||||
{
|
{
|
||||||
std::cout << "UnRegisterFunction<Foo>\n";
|
std::cout << "UnRegisterFunction<Foo>\n";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
template<> bool UnRegisterFunction<Boo>()
|
template<> bool UnRegisterFunction<Boo>()
|
||||||
{
|
{
|
||||||
std::cout << "UnRegisterFunction<Boo>\n";
|
std::cout << "UnRegisterFunction<Boo>\n";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,16 +19,16 @@
|
||||||
|
|
||||||
struct Foo : Base
|
struct Foo : Base
|
||||||
{
|
{
|
||||||
Foo();
|
Foo();
|
||||||
virtual ~Foo();
|
virtual ~Foo();
|
||||||
void foo();
|
void foo();
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Boo : Base
|
struct Boo : Base
|
||||||
{
|
{
|
||||||
Boo();
|
Boo();
|
||||||
virtual ~Boo();
|
virtual ~Boo();
|
||||||
void foo();
|
void foo();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,14 +21,14 @@
|
||||||
|
|
||||||
typedef Loki::SingletonHolder
|
typedef Loki::SingletonHolder
|
||||||
<
|
<
|
||||||
Loki::Factory<Base, std::string>
|
Loki::Factory<Base, std::string>
|
||||||
>
|
>
|
||||||
BaseFactory;
|
BaseFactory;
|
||||||
|
|
||||||
|
|
||||||
bool registerClass(std::string key, Base*(*creator)() )
|
bool registerClass(std::string key, Base*(*creator)() )
|
||||||
{
|
{
|
||||||
return BaseFactory::Instance().Register(key,creator);
|
return BaseFactory::Instance().Register(key,creator);
|
||||||
}
|
}
|
||||||
|
|
||||||
Loki::RegisterOnCreateSet<ClassList> registerAllClasses;
|
Loki::RegisterOnCreateSet<ClassList> registerAllClasses;
|
||||||
|
@ -37,18 +37,18 @@ Loki::UnRegisterOnDeleteSet<ClassList> unregisterAllClasses;
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
Base* foo = BaseFactory::Instance().CreateObject("Foo");
|
Base* foo = BaseFactory::Instance().CreateObject("Foo");
|
||||||
Base* boo = BaseFactory::Instance().CreateObject("Boo");
|
Base* boo = BaseFactory::Instance().CreateObject("Boo");
|
||||||
|
|
||||||
foo->foo();
|
foo->foo();
|
||||||
boo->foo();
|
boo->foo();
|
||||||
|
|
||||||
delete foo;
|
delete foo;
|
||||||
delete boo;
|
delete boo;
|
||||||
|
|
||||||
#if defined(__BORLANDC__) || defined(_MSC_VER)
|
#if defined(__BORLANDC__) || defined(_MSC_VER)
|
||||||
system("PAUSE");
|
system("PAUSE");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ public:
|
||||||
//TODO:
|
//TODO:
|
||||||
// BindFirst and Chainer
|
// BindFirst and Chainer
|
||||||
|
|
||||||
Functor<void,Seq<bool &> > member_func(&testClass,&TestClass::member);
|
Functor<void,Seq<bool &> > member_func(&testClass,&TestClass::member);
|
||||||
Functor<void,Seq<bool &> > free_func(&free_function);
|
Functor<void,Seq<bool &> > free_func(&free_function);
|
||||||
Functor<void,Seq<bool &> > NULL_func;
|
Functor<void,Seq<bool &> > NULL_func;
|
||||||
Functor<void,Seq<bool &> > NULL_func0;
|
Functor<void,Seq<bool &> > NULL_func0;
|
||||||
|
@ -141,7 +141,7 @@ public:
|
||||||
&& bindFunctorCompare
|
&& bindFunctorCompare
|
||||||
&& chainFunctorCompare;
|
&& chainFunctorCompare;
|
||||||
#else
|
#else
|
||||||
;
|
;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -86,102 +86,102 @@ public:
|
||||||
|
|
||||||
bool test1=TestClass::instances == 0;
|
bool test1=TestClass::instances == 0;
|
||||||
|
|
||||||
{ p0 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p0 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p1 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p1 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p2 p(new TestClass); p2 pp(p); } LOKI_assert(TestClass::instances==0);
|
{ p2 p(new TestClass); p2 pp(p); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p3 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p3 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p4 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p4 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p5 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p5 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p6 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p6 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p7 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p7 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p8 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p8 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p9 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p9 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p10 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p10 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p11 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p11 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p12 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p12 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p13 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p13 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p14 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p14 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p15 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p15 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p16 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p16 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p17 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p17 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p18 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p18 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p19 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p19 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p20 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p20 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p21 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p21 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p22 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p22 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p23 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p23 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p24 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p24 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p25 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p25 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p26 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p26 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p27 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p27 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p28 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p28 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p29 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p29 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p30 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p30 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p31 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p31 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p40 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p40 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p41 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p41 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p42 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p42 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p43 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p43 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p44 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p44 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p45 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p45 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p46 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p46 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p47 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p47 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p48 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p48 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p49 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p49 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p50 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p50 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p51 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p51 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p52 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p52 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p53 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p53 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p54 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p54 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p55 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p55 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p56 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p56 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p57 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p57 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p58 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p58 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p59 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p59 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p60 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p60 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p61 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p61 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p62 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p62 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p63 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p63 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p64 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p64 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p65 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p65 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p66 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p66 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p67 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p67 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p68 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p68 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p69 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p69 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p70 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p70 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p71 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p71 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p72 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p72 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p73 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p73 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p74 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p74 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p75 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p75 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p76 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p76 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p77 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p77 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p78 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p78 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p79 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p79 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p80 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p80 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p81 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p81 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p82 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p82 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p83 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p83 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p84 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p84 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p85 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p85 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p86 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p86 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p87 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p87 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p88 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p88 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p89 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p89 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p90 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p90 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p91 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p91 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p92 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p92 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p93 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p93 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p94 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p94 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p95 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p95 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p96 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p96 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p97 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p97 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p98 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p98 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p99 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p99 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p100 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p100 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p101 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p101 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p102 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
{ p102 p(new TestClass); } LOKI_assert(TestClass::instances==0);
|
||||||
{ p103 p(new TestClass); }
|
{ p103 p(new TestClass); }
|
||||||
|
|
||||||
bool test2=TestClass::instances==0;
|
bool test2=TestClass::instances==0;
|
||||||
|
|
||||||
|
|
|
@ -32,15 +32,15 @@ Test for singletons in a shared libraries:
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
Foo& foo = Singleton<Foo>::Instance();
|
Foo& foo = Singleton<Foo>::Instance();
|
||||||
Foo& lokifoo = Loki::Singleton<Foo>::Instance();
|
Foo& lokifoo = Loki::Singleton<Foo>::Instance();
|
||||||
foo.foo();
|
foo.foo();
|
||||||
lokifoo.foo();
|
lokifoo.foo();
|
||||||
|
|
||||||
|
|
||||||
#if defined(__BORLANDC__) || defined(_MSC_VER)
|
#if defined(__BORLANDC__) || defined(_MSC_VER)
|
||||||
system("PAUSE");
|
system("PAUSE");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,5 +21,5 @@ Foo::Foo()
|
||||||
|
|
||||||
void Foo::foo()
|
void Foo::foo()
|
||||||
{
|
{
|
||||||
std::cout << "\nFoo:foo() called, this: " << this << "\n";
|
std::cout << "\nFoo:foo() called, this: " << this << "\n";
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,9 +21,9 @@
|
||||||
class FOO_EXPORT Foo
|
class FOO_EXPORT Foo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Foo();
|
Foo();
|
||||||
|
|
||||||
void foo();
|
void foo();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,11 +23,11 @@ LOKI_SINGLETON_INSTANCE_DEFINITION(FooSingleton)
|
||||||
/*
|
/*
|
||||||
namespace Loki
|
namespace Loki
|
||||||
{
|
{
|
||||||
template<>
|
template<>
|
||||||
FooSingleton::ObjectType& Singleton<FooSingleton::ObjectType>::Instance()
|
FooSingleton::ObjectType& Singleton<FooSingleton::ObjectType>::Instance()
|
||||||
{
|
{
|
||||||
return FooSingleton::Instance();
|
return FooSingleton::Instance();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ namespace Loki
|
||||||
template<>
|
template<>
|
||||||
Foo& Singleton<Foo>::Instance()
|
Foo& Singleton<Foo>::Instance()
|
||||||
{
|
{
|
||||||
return FooSingleton::Instance();
|
return FooSingleton::Instance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ template<class T>
|
||||||
class Singleton
|
class Singleton
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static T& Instance();
|
static T& Instance();
|
||||||
};
|
};
|
||||||
|
|
||||||
template class SINGLETONDLL_EXPORT Singleton<Foo>;
|
template class SINGLETONDLL_EXPORT Singleton<Foo>;
|
||||||
|
|
|
@ -33,7 +33,7 @@ class VariableVisitor :
|
||||||
//public Loki::Visitor<Base>,
|
//public Loki::Visitor<Base>,
|
||||||
//public Loki::Visitor<Type1>
|
//public Loki::Visitor<Type1>
|
||||||
#ifndef LOKI_DISABLE_TYPELIST_MACROS
|
#ifndef LOKI_DISABLE_TYPELIST_MACROS
|
||||||
public Loki::Visitor<LOKI_TYPELIST_2(Base,Type1)>
|
public Loki::Visitor<LOKI_TYPELIST_2(Base,Type1)>
|
||||||
#else
|
#else
|
||||||
public Loki::Visitor<Loki::Seq<Base,Type1>::Type>
|
public Loki::Visitor<Loki::Seq<Base,Type1>::Type>
|
||||||
#endif
|
#endif
|
||||||
|
@ -61,7 +61,7 @@ class CVariableVisitor :
|
||||||
//public Loki::Visitor<CBase,void,true>,
|
//public Loki::Visitor<CBase,void,true>,
|
||||||
//public Loki::Visitor<CType1,void,true>
|
//public Loki::Visitor<CType1,void,true>
|
||||||
#ifndef LOKI_DISABLE_TYPELIST_MACROS
|
#ifndef LOKI_DISABLE_TYPELIST_MACROS
|
||||||
public Loki::Visitor<LOKI_TYPELIST_2(CBase,CType1),void,true>
|
public Loki::Visitor<LOKI_TYPELIST_2(CBase,CType1),void,true>
|
||||||
#else
|
#else
|
||||||
public Loki::Visitor<Loki::Seq<CBase,CType1>::Type,void,true>
|
public Loki::Visitor<Loki::Seq<CBase,CType1>::Type,void,true>
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue