본문 바로가기
Programming/STL

pair와 make_pair의 차이

by Eisen Sophie 2020. 12. 6.

pair는 data type을 명시해줘야한다.

make_pair는 data type을 명시해줄 필요가 없다.

 

 

map<K,V> combined;

 

combined.insert(pair<K, V>(it->first, it->second));

 

combined.insert(make_pair(it->first, it->second));

 

위의 두개는 같은 동작을 한다.

'Programming > STL' 카테고리의 다른 글

STL Container들 간략 정리  (0) 2020.10.13