Mercurial > emacs
comparison test/cedet/tests/testtypedefs.cpp @ 105267:c99cf31de3f2
Add CEDET tests.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Mon, 28 Sep 2009 23:23:31 +0000 |
parents | e480034314ce |
children | 7f4c7f5c0eba |
comparison
equal
deleted
inserted
replaced
105266:c02e98221afe | 105267:c99cf31de3f2 |
---|---|
1 // Sample with some fake bits out of std::string | |
2 // | |
3 // Thanks Ming-Wei Chang for these examples. | |
4 | |
5 namespace std { | |
6 | |
7 template <T>class basic_string { | |
8 | |
9 public: | |
10 void resize(int); | |
11 | |
12 }; | |
13 | |
14 } | |
15 | |
16 typedef std::basic_string<char> mstring; | |
17 | |
18 using namespace std; | |
19 typedef basic_string<char> bstring; | |
20 | |
21 | |
22 int main(){ | |
23 mstring a; | |
24 | |
25 a.// -1- | |
26 ; | |
27 // #1# ( "resize" ) | |
28 | |
29 bstring b; | |
30 // It doesn't work here. | |
31 b.// -2- | |
32 ; | |
33 // #2# ( "resize" ) | |
34 | |
35 return 0; | |
36 } | |
37 | |
38 | |
39 // ------------------ | |
40 | |
41 class Bar | |
42 { | |
43 public: | |
44 void someFunc() {} | |
45 | |
46 }; | |
47 | |
48 typedef Bar new_Bar; | |
49 | |
50 template <class mytype> | |
51 class TBar | |
52 { | |
53 public: | |
54 void otherFunc() {} | |
55 | |
56 }; | |
57 | |
58 typedef TBar<char> new_TBar; | |
59 | |
60 int main() | |
61 { | |
62 new_Bar nb; | |
63 new_TBar ntb; | |
64 | |
65 nb.// -3- | |
66 ; | |
67 // #3# ("someFunc") | |
68 | |
69 ntb.// -4- | |
70 ; | |
71 // #4# ("otherFunc") | |
72 | |
73 return 0; | |
74 } |