clean up
git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@479 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
parent
d33f2e6585
commit
47e962d64b
4 changed files with 33 additions and 29 deletions
|
@ -226,18 +226,6 @@
|
||||||
RelativePath="..\..\include\loki\Pimpl.h"
|
RelativePath="..\..\include\loki\Pimpl.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\..\include\loki\Pimpl.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\include\loki\PimplDef.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\include\loki\PimplDef.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\include\loki\SafeFormat.h"
|
RelativePath="..\..\include\loki\SafeFormat.h"
|
||||||
>
|
>
|
||||||
|
|
|
@ -23,8 +23,6 @@
|
||||||
#include "type.h"
|
#include "type.h"
|
||||||
#include "type2.h"
|
#include "type2.h"
|
||||||
|
|
||||||
#include <loki/PimplDef.h>
|
|
||||||
|
|
||||||
#include <loki/SafeFormat.h>
|
#include <loki/SafeFormat.h>
|
||||||
|
|
||||||
|
|
||||||
|
@ -97,7 +95,7 @@ namespace Loki // gcc!!
|
||||||
/////////////////////////////////////////
|
/////////////////////////////////////////
|
||||||
// class C definition
|
// class C definition
|
||||||
/////////////////////////////////////////
|
/////////////////////////////////////////
|
||||||
C::C() : d(rlife)
|
C::C() : d(rinit)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void C::foo()
|
void C::foo()
|
||||||
|
@ -208,24 +206,28 @@ P2::P2(){d->data = 2;}
|
||||||
P3::P3(){d->data = 3;}
|
P3::P3(){d->data = 3;}
|
||||||
P4::P4(){d->data = 4;}
|
P4::P4(){d->data = 4;}
|
||||||
P5::P5(){d->data = 5;}
|
P5::P5(){d->data = 5;}
|
||||||
|
P6::P6(){d->data = 6;}
|
||||||
|
|
||||||
R1::R1(){d.data = 11;}
|
R1::R1(){d.data = 11;}
|
||||||
R2::R2(){d.data = 22;}
|
R2::R2(){d.data = 22;}
|
||||||
R3::R3(){d.data = 33;}
|
R3::R3(){d.data = 33;}
|
||||||
R4::R4():d(t){d.data = 44;}
|
R4::R4():d(rinit){d.data = 44;}
|
||||||
R5::R5():d(t){d.data = 55;}
|
R5::R5():d(rinit){d.data = 55;}
|
||||||
R6::R6():d(t){d.data = 66;}
|
R6::R6():d(rinit){d.data = 66;}
|
||||||
|
|
||||||
void test_more()
|
void test_more()
|
||||||
{
|
{
|
||||||
Loki::Printf("\nmore tests:\n");
|
Loki::Printf("\n\nMore tests:\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;
|
||||||
|
P6* p6 = new P6;
|
||||||
|
|
||||||
|
Loki::Printf("\nCreating Rimpls\n");
|
||||||
R1* r1 = new R1;
|
R1* r1 = new R1;
|
||||||
R2* r2 = new R2;
|
R2* r2 = new R2;
|
||||||
R3* r3 = new R3;
|
R3* r3 = new R3;
|
||||||
|
@ -234,12 +236,15 @@ void test_more()
|
||||||
R6* r6 = new R6;
|
R6* r6 = new R6;
|
||||||
|
|
||||||
|
|
||||||
|
Loki::Printf("\nDeleting Pimpls\n");
|
||||||
delete p1;
|
delete p1;
|
||||||
delete p2;
|
delete p2;
|
||||||
delete p3;
|
delete p3;
|
||||||
delete p4;
|
delete p4;
|
||||||
delete p5;
|
delete p5;
|
||||||
|
delete p6;
|
||||||
|
|
||||||
|
Loki::Printf("\nDeleting Rimpls\n");
|
||||||
delete r1;
|
delete r1;
|
||||||
delete r2;
|
delete r2;
|
||||||
delete r3;
|
delete r3;
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
#include <loki/Pimpl.h>
|
#include <loki/Pimpl.h>
|
||||||
|
|
||||||
|
|
||||||
//#define TEST_WITH_BOOST
|
//#define TEST_WITH_BOOST
|
||||||
#ifdef TEST_WITH_BOOST
|
#ifdef TEST_WITH_BOOST
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
|
@ -64,7 +65,7 @@ public:
|
||||||
void foo();
|
void foo();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Rimpl<C>::Life rlife;
|
Rimpl<C>::Init rinit;
|
||||||
Rimpl<C>::Type& d;
|
Rimpl<C>::Type& d;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -146,6 +147,15 @@ typedef Loki::PtrImpl
|
||||||
>
|
>
|
||||||
Pimpl5;
|
Pimpl5;
|
||||||
|
|
||||||
|
typedef Loki::PtrImpl
|
||||||
|
<
|
||||||
|
Loki::Impl<B>,
|
||||||
|
Loki::Impl<B>*,
|
||||||
|
Loki::AutoDeletePimpl,
|
||||||
|
Loki::DeclaredPimpl
|
||||||
|
>
|
||||||
|
Pimpl6;
|
||||||
|
|
||||||
|
|
||||||
// Pimpl
|
// Pimpl
|
||||||
|
|
||||||
|
@ -241,13 +251,13 @@ Pimpl8;
|
||||||
template<class T>
|
template<class T>
|
||||||
struct R
|
struct R
|
||||||
{
|
{
|
||||||
typedef Loki::PimplLife
|
typedef Loki::Private::AutoPtrHolder
|
||||||
<
|
<
|
||||||
T,
|
T,
|
||||||
T*,
|
T*,
|
||||||
Loki::AutoDeletePimpl
|
Loki::AutoDeletePimpl
|
||||||
>
|
>
|
||||||
Life;
|
Init;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -256,12 +266,13 @@ struct P2 : private Pimpl2 {P2();};
|
||||||
struct P3 : private Pimpl3 {P3();};
|
struct P3 : private Pimpl3 {P3();};
|
||||||
struct P4 {Pimpl4 d; P4();};
|
struct P4 {Pimpl4 d; P4();};
|
||||||
struct P5 {Pimpl5 d; P5();};
|
struct P5 {Pimpl5 d; P5();};
|
||||||
|
struct P6 {Pimpl6 d; P6();};
|
||||||
|
|
||||||
struct R1 : private Rimpl1 {R1();};
|
struct R1 : private Rimpl1 {R1();};
|
||||||
struct R2 : private Rimpl2 {R2();};
|
struct R2 : private Rimpl2 {R2();};
|
||||||
struct R3 : private Rimpl3 {R3();};
|
struct R3 : private Rimpl3 {R3();};
|
||||||
struct R4 {Rimpl4& d; R<Rimpl4>::Life t; R4();};
|
struct R4 {Rimpl4& d; R<Rimpl4>::Init rinit; R4();};
|
||||||
struct R5 {Rimpl5& d; R<Rimpl5>::Life t; R5();};
|
struct R5 {Rimpl5& d; R<Rimpl5>::Init rinit; R5();};
|
||||||
struct R6 {Rimpl6& d; R<Rimpl6>::Life t; R6();};
|
struct R6 {Rimpl6& d; R<Rimpl6>::Init rinit; R6();};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ public:
|
||||||
void foo();
|
void foo();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Pimpl<A>::Type d;
|
Pimpl<A2>::Type d;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ public:
|
||||||
void foo();
|
void foo();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Rimpl<C2>::Life rlife;
|
Rimpl<C2>::Init rint;
|
||||||
Rimpl<C2>::Type& d;
|
Rimpl<C2>::Type& d;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue