Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 수광 소자
- Stack
- stl
- list
- 통계학
- Visual Micro
- queue
- Algorithm
- 컴퓨터 그래픽스
- C언어
- Arduino
- 운영체제
- arduino compiler
- priority_queue
- WinAPI
- Deque
- 아두이노
- c++
- 시스템프로그래밍
- 아두이노 컴파일러
- LineTracer
- directx
- vector
- Array
- 아두이노 소스
- 자료구조
- 라인트레이서
- map
- set
- html
Archives
- Today
- Total
Kim's Programming
Map - at() 본문
소스)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #include<iostream> #include<string> #include<map> void print(std::map<int, std::string> Target_Map) { for (std::map<int, std::string>::iterator IterPos = Target_Map.begin(); IterPos != Target_Map.end(); ++IterPos) std::cout << "Key->" << IterPos->first << ", Value->" << IterPos->second << " "; std::cout << std::endl; } void main() { std::map<int, std::string> Map; Map[1] = "First"; Map[2] = "Second"; Map[3] = "Third"; Map[4] = "Fourth"; print(Map); std::cout << Map.at(3) << std::endl; print(Map); } | cs |
내용)
at(x)함수는 key값 x에 대응하는 값을 리턴합니다. x에 해당하는 값이 없으면 abort()를 리턴합니다.
결과)
'STL - Container > Container - Map' 카테고리의 다른 글
Map - Clear() (0) | 2016.02.01 |
---|---|
Map - cend() (0) | 2016.02.01 |
Map - cbegin() (0) | 2016.02.01 |
Map - begin() (0) | 2016.02.01 |
Map - 맴버변수 (0) | 2016.02.01 |