Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
27 lines (24 loc) · 730 Bytes

File metadata and controls

27 lines (24 loc) · 730 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
//
// Created by light on 19-11-4.
//
#include <iostream>
#include <tuple>
using namespace std;
// tuple使用
int main() {
tuple<int, int, string> t, t1, t2;
t = make_tuple(1, 2, "qwe");
t1 = make_tuple(3, 2, "qwe");
t2 = make_tuple(3, 2, "qwe");
int a = get<0>(t);
get<0>(t) = get<1>(t); // 可以修改
cout << a << endl;
cout << (get<0>(t) > get<1>(t) ? "true" : "false") << endl; // 比较大小
cout << (t1 == t2 ? "true" : "false") << endl;
typedef tuple<int, int, int, string> T;
cout << tuple_size<T>::value << endl; // meta programming 处理类型
cout << tuple_size<T>::value << endl;
tuple_element<1, T>::type a1 = 10;
cout << a1 << endl;
return 0;
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.