C++/Skill (기본지식, 모던C++)

모던C++) 두개의 값을 갖는 pair<>, make_pair()

신우섭 2020. 5. 20. 20:13

pair<>

pair<int, int> temp;
temp.first = 111;
temp.second = 222;

cout << temp.first;
cout << temp.second

결과 값 : 111222

make_pair()

vector<pair<int, int>> vecTemp;
vecTemp.push_back(make_pair(111,222));

cout << vecTemp[0].first;
cout << vecTemp[0].second;

결과 값 : 111222