]>
Commit | Line | Data |
---|---|---|
a520f0b0 BK |
1 | // 2004-09-23 Chris Jefferson <chris@bubblescope.net> |
2 | ||
395c9e79 PC |
3 | // Copyright (C) 2004, 2005, 2006, 2007, 2008 |
4 | // Free Software Foundation, Inc. | |
a520f0b0 BK |
5 | // |
6 | // This file is part of the GNU ISO C++ Library. This library is free | |
7 | // software; you can redistribute it and/or modify it under the | |
8 | // terms of the GNU General Public License as published by the | |
9 | // Free Software Foundation; either version 2, or (at your option) | |
10 | // any later version. | |
11 | ||
12 | // This library is distributed in the hope that it will be useful, | |
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | // GNU General Public License for more details. | |
16 | ||
17 | // You should have received a copy of the GNU General Public License along | |
18 | // with this library; see the file COPYING. If not, write to the Free | |
83f51799 | 19 | // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
a520f0b0 BK |
20 | // USA. |
21 | ||
22 | // Tuple | |
23 | ||
24 | #include <tr1/tuple> | |
25 | #include <testsuite_hooks.h> | |
26 | ||
2df6377e DG |
27 | using namespace std::tr1; |
28 | using std::pair; | |
a520f0b0 BK |
29 | |
30 | int | |
31 | main() | |
32 | { | |
a1c1054b PC |
33 | bool test __attribute__((unused)) = true; |
34 | ||
a520f0b0 BK |
35 | int x1=0,x2=0; |
36 | const int &z1=x1; | |
37 | ||
38 | // Test empty constructor | |
395c9e79 | 39 | tuple<> ta __attribute__((unused)); |
a520f0b0 BK |
40 | tuple<int,int> tb; |
41 | // Test construction from values | |
42 | tuple<int,int> tc(x1,x2); | |
43 | tuple<int,int&> td(x1,x2); | |
44 | tuple<const int&> te(z1); | |
45 | x1=1; | |
46 | x2=1; | |
47 | VERIFY(get<0>(td) == 0 && get<1>(td) == 1 && get<0>(te) == 1); | |
48 | ||
49 | // Test identical tuple copy constructor | |
50 | tuple<int,int> tf(tc); | |
51 | tuple<int,int> tg(td); | |
52 | tuple<const int&> th(te); | |
53 | // Test different tuple copy constructor | |
54 | tuple<int,double> ti(tc); | |
55 | tuple<int,double> tj(td); | |
56 | //tuple<int&, int&> tk(tc); | |
57 | tuple<const int&, const int&> tl(tc); | |
58 | tuple<const int&, const int&> tm(tl); | |
59 | // Test constructing from a pair | |
60 | pair<int,int> pair1(1,1); | |
61 | const pair<int,int> pair2(pair1); | |
62 | tuple<int,int> tn(pair1); | |
63 | tuple<int,const int&> to(pair1); | |
64 | tuple<int,int> tp(pair2); | |
65 | tuple<int,const int&> tq(pair2); | |
66 | return 0; | |
67 | } | |
68 |