This source file includes following definitions.
- main
- foo
- bar
- main2
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 template <class T, int U, class V>
27 class read_ref {
28 public:
29 const T* read_ref_member_one( T);
30 const V* read_ref_member_two();
31 };
32
33 namespace NS {
34 template <class T, int U, class V>
35 class ref {
36 public:
37 read_ref<T,10,V> operator->() {
38 m_
39 ;
40
41 }
42
43 private:
44 T m_datas[U];
45 };
46
47 }
48
49 class FooOne {
50 public:
51 int fooOneMember();
52 };
53
54 class FooTwo {
55 public:
56 int fooTwoMember();
57 };
58
59 class FooThree {
60 public:
61 int fooThreeMember();
62
63 FooOne * operator->();
64 };
65
66 typedef ref<FooOne, 10,FooTwo> Test;
67
68 using NS;
69
70 void
71 main(void) {
72 ref<FooOne, 10, FooTwo> v;
73
74 v->read_ref_member_one()->
75 ;
76
77
78 v->read_ref_member_two()->
79 ;
80
81
82 v->
83 ;
84
85
86 Test t;
87
88 t->read_ref_member_two()->
89 ;
90
91
92 ref<FooOne, 10, FooThree> v2;
93
94 v2->read_ref_member_two()->
95 ;
96
97
98
99 NS::ref<FooOne, 10, FooTwo> v3;
100
101 v3->read_ref_member_one()->
102 ;
103
104
105 v3->read_ref_member_two()->
106 ;
107
108
109 v3->read_ref_member_two
110 ;
111
112 }
113
114
115
116 template<typename T>
117 struct isFooLike {
118 static const bool value = false;
119 };
120
121 template <>
122 struct isFooLike<int> {
123 static const bool value = true;
124 };
125
126
127 template <typename T, bool isFoo>
128 class A {
129 public:
130 A();
131 void foo() {};
132 };
133
134
135 template <typename T>
136 class FooFour : public A<T, isPodLike<T>::value> {
137 public:
138 bool bar() {}
139 };
140
141
142 int main2() {
143
144 FooFour<int> ff;
145
146 ff.
147 ;
148
149 }