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 |
Tags
- 컴퓨터 그래픽스
- html
- queue
- list
- Visual Micro
- LineTracer
- 자료구조
- set
- Arduino
- 수광 소자
- 아두이노
- 통계학
- arduino compiler
- 아두이노 컴파일러
- c++
- Algorithm
- vector
- 라인트레이서
- 운영체제
- Stack
- priority_queue
- 시스템프로그래밍
- directx
- C언어
- stl
- map
- WinAPI
- 아두이노 소스
- Array
- Deque
Archives
- Today
- Total
Kim's Programming
Map - size() 본문
소스)
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 | #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 print(std::pair<int, std::string> Target_Pair) { std::cout << Target_Pair.first << " " << Target_Pair.second << std::endl; } void main() { std::map<int, std::string> Map; Map[1] = "First"; Map[2] = "Second"; Map[3] = "Third"; print(Map); std::cout << Map.size() << std::endl; print(Map); } | cs |
내용)
size()함수는 map에 있는 요소의 갯수를 리턴합니다.
결과)
'STL - Container > Container - Map' 카테고리의 다른 글
Map - upper_bound() (0) | 2016.02.01 |
---|---|
Map - swap() (0) | 2016.02.01 |
Map - rend() (0) | 2016.02.01 |
Map - rbegin() (0) | 2016.02.01 |
Map - Operator [] (0) | 2016.02.01 |