File: type2.h

package info (click to toggle)
libloki 0.1.7-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,608 kB
  • sloc: cpp: 30,475; ansic: 1,974; makefile: 365; php: 316; perl: 108
file content (135 lines) | stat: -rw-r--r-- 2,434 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
////////////////////////////////////////////////////////////////////////////////
// The Loki Library
// Copyright (c) 2006 Peter Kmmel
// Permission to use, copy, modify, distribute and sell this software for any 
//     purpose is hereby granted without fee, provided that the above copyright 
//     notice appear in all copies and that both that copyright notice and this 
//     permission notice appear in supporting documentation.
// The author makes no representations about the 
//     suitability of this software for any purpose. It is provided "as is" 
//     without express or implied warranty.
////////////////////////////////////////////////////////////////////////////////

// $Id: type2.h 761 2006-10-17 20:48:18Z syntheticpp $


#include <loki/Pimpl.h>

/////////////////////////////////////////
// class A2 declaration
/////////////////////////////////////////

template< class T>
class Impl;

class A2
{
public:
    A2();
    ~A2();
    void foo();

private:
    PimplOf<A2>::Type d;
};


/////////////////////////////////////////
// class B2 declaration
/////////////////////////////////////////

class B2 : private PimplOf<B2>::Owner
{
public:
    B2();
    ~B2();
    void foo();
};



/////////////////////////////////////////
// class C2 declaration
/////////////////////////////////////////

class C2
{
public:
    C2();
    ~C2();
    void foo();

private:
    PimplOf<C2>::Type rint; 
    RimplOf<C2>::Type d; 
};


/////////////////////////////////////////
// class D2 declaration
/////////////////////////////////////////

class D2 : private RimplOf<D2>::Owner
{
public:
    D2();
    ~D2();
    void foo();
};


/////////////////////////////////////////
// incomplete type test
/////////////////////////////////////////
class Incomplete1
{
public:
    Incomplete1();
    void foo();
private:
    PimplOf<Incomplete1>::Type d;
};

class Incomplete2
{
public:
    Incomplete2();
    ~Incomplete2();
    void foo();
private:
    PimplOf<Incomplete2>::Type d;
};


// Test: don't compile with inline destructor 
#if 0

class Incomplete3
{
public:
    Incomplete3();
    ~Incomplete3()
    {
        // inline destructor
    }
    void foo();
private:
    PimplOf<Incomplete3>::Type d;
};
#endif


// Test: don't compile with incomplete type and auto_ptr

#include <memory>

class Impl4;
class Incomplete4
{
public:
    Incomplete4();
    void foo();
private:
    Pimpl<Impl4, std::auto_ptr<Impl4> > d;
};