* Computer Science/C++

vector pair 사용

soicem 2018. 3. 22. 14:04

 캐시를 하려하는데 vector에 튜플 형식으로 변수가 들어가는 것을 원하던 중 pair라는 구문을 발견, 그러나 2개만 들어가게 만들어놓은 이유는 무엇인지...


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
using namespace std;
vector<pair<stringint>> cache;
int main()
{
    string a = "soicem";
    cache.resize(1000);
    cache[10= make_pair(a, 100);
    cout << cache[10].first << endl;
    cout << cache[10].second << endl;
 
 
    system("pause");
    return 0;
}
cs


'* Computer Science > C++' 카테고리의 다른 글

c++로 스플릿하기  (0) 2018.09.27
stack with template  (0) 2018.05.28
Combination & memset  (0) 2018.04.04
2차원 벡터 생성  (0) 2018.03.30
C++ 기본 문법 정리  (0) 2017.12.13