repo.or.cz
/
OpenFOAM-2.0.x.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
ENH: autoLayerDriver: better layering information message
[OpenFOAM-2.0.x.git]
/
applications
/
test
/
alloc
/
Test.C
blob
67f77ab05c8d9248b72426af0bfd8e4219afac2e
1
#include <stdlib.h>
2
3
class Int
4
{
5
int I;
6
7
public:
8
9
Int(){}
10
11
operator int()
12
{
13
return I;
14
}
15
};
16
17
18
template<class T>
19
class List : public T
20
{
21
T* v;
22
int sz;
23
24
public:
25
26
List()
27
{
28
v = new T[sz=10];
29
}
30
31
List(int s)
32
{
33
v = new T[sz=s];
34
}
35
36
~List()
37
{
38
delete[] v;
39
}
40
41
inline int size() const;
42
43
};
44
45
46
template<class T>
47
inline int List<T>::size() const
48
{
49
return sz;
50
}
51
52
53
#include <stream.h>
54
55
main()
56
{
57
typedef List<Int> intList;
58
59
intList list(10);
60
61
cout << list.size() << "\n";
62
63
return 0;
64
}