1 /*
2 * Copyright (C) 2015-2019 Alibaba Group Holding Limited
3 */
4 #include <iostream>
5 #include <string>
6 #include <tuple>
7
8 using namespace std;
9
tuple_test(void)10 void tuple_test(void)
11 {
12 string name;
13 char x;
14 double p;
15 int l;
16
17 auto tup0 = std::make_tuple("Hello World!", 'a', 1.23, 6);
18 auto tup1 = std::make_tuple("Hello ATOS!", 'b', 3.14, 7);
19
20 std::tie(name, x, p, l) = tup0;
21 cout << "data from tup0 is:" << name << " " << x << " " << p << " " << l
22 << endl;
23
24 auto tup2 = tuple_cat(tup0, tup1);
25 int size = tuple_size<decltype(tup2)>::value;
26
27 if (size != 8) {
28 cout << "tuple test error, size is:" << size << endl;
29 } else {
30 cout << "tuple test ok" << endl;
31 }
32 }
33