]> code.delx.au - gnu-emacs/blob - test/cedet/tests/testtypedefs.cpp
Update copyright year to 2016
[gnu-emacs] / test / cedet / tests / testtypedefs.cpp
1 // testtypedefs.cpp --- Sample with some fake bits out of std::string
2
3 // Copyright (C) 2008-2016 Free Software Foundation, Inc.
4
5 // Author: Eric M. Ludlam <eric@siege-engine.com>
6
7 // This file is part of GNU Emacs.
8
9 // GNU Emacs is free software: you can redistribute it and/or modify
10 // it under the terms of the GNU General Public License as published by
11 // the Free Software Foundation, either version 3 of the License, or
12 // (at your option) any later version.
13
14 // GNU Emacs is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 // GNU General Public License for more details.
18
19 // You should have received a copy of the GNU General Public License
20 // along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
21
22 // Thanks Ming-Wei Chang for these examples.
23
24 namespace std {
25 template <T>class basic_string {
26 public:
27 void resize(int);
28 };
29 }
30
31 typedef std::basic_string<char> mstring;
32
33 using namespace std;
34 typedef basic_string<char> bstring;
35
36 int main(){
37 mstring a;
38 a.// -1-
39 ;
40 // #1# ( "resize" )
41 bstring b;
42 // It doesn't work here.
43 b.// -2-
44 ;
45 // #2# ( "resize" )
46 return 0;
47 }
48
49 // ------------------
50
51 class Bar
52 {
53 public:
54 void someFunc() {}
55 };
56
57 typedef Bar new_Bar;
58
59 template <class mytype>
60 class TBar
61 {
62 public:
63 void otherFunc() {}
64 };
65
66 typedef TBar<char> new_TBar;
67
68 int main()
69 {
70 new_Bar nb;
71 new_TBar ntb;
72
73 nb.// -3-
74 ;
75 // #3# ("someFunc")
76 ntb.// -4-
77 ;
78 // #4# ("otherFunc")
79 return 0;
80 }
81