반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 28 |
Tags
- incr
- 오퍼레터
- Docker
- softeer
- dfs
- BFS
- boj #19237 #어른 상어
- 6987
- BOJ
- 퇴사통보
- 이분탐색
- 소프티어
- @P0
- 백트래킹
- 물채우기
- 성적평가
- 경력
- 13908
- compose
- 파라메트릭
- 백준
- Kafka
- 기술면접
- 매개변수탐색
- 처우협의
- upper_bound
- 처우산정
- OFFSET
- msSQL
- 연결요소
Archives
- Today
- Total
기술 블로그
#include <tuple> 본문
728x90
반응형
#include <tuple> 헤더 선언 해줘야한다.
pair<pair<int, int>, int> > 이런 pair 형식이 귀찮았는데 tuple을 알게 되었다.
다음에 풀 때는 tuple을 사용해보록 하겠다.
값을 불러올 때는 get<순서 번호>(튜플 관련 선언 이름);
이런 식으로 하면 된다.
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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | #include <iostream> #include <queue> #include <stack> #include <cstdio> #include <vector> #include <cstring> #include <string> #include <math.h> #include <algorithm> #include <map> #include <set> #include <tuple> #pragma warning(disable:4996) #pragma comment(linker, "/STACK:336777216") using namespace std; vector<tuple<int, int, int> > v1; vector<tuple<int, char, string> > v2; int main(void) { v1.push_back({ 1, 2, 3 }); for (auto i : v1) { cout << get<0>(i) << '\n'; cout << get<1>(i) << '\n'; cout << get<2>(i) << '\n'; } cout << "-------------------------\n"; v2.push_back({ 8, 'A', "C++ STL tuple Sample Test" }); for (auto i : v2) { cout << get<0>(i) << '\n'; cout << get<1>(i) << '\n'; cout << get<2>(i) << '\n'; } return 0; } | cs |
728x90
반응형
'C++ STL' 카테고리의 다른 글
string to int(문자열을 int로 변환) (0) | 2019.04.16 |
---|---|
#include <map> (0) | 2019.03.22 |
2차원 배열 fill로 초기화.(feat memset) (2) | 2019.01.10 |
next_permutation (0) | 2019.01.09 |
vector 간단한 insert, erase (0) | 2018.12.09 |