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 | 
                            Tags
                            
                        
                          
                          - stl
 - 통계학
 - queue
 - c++
 - 아두이노 소스
 - 아두이노 컴파일러
 - Arduino
 - 라인트레이서
 - C언어
 - arduino compiler
 - 시스템프로그래밍
 - Array
 - 아두이노
 - Stack
 - 운영체제
 - Deque
 - html
 - 자료구조
 - priority_queue
 - map
 - Visual Micro
 - 컴퓨터 그래픽스
 - vector
 - LineTracer
 - directx
 - Algorithm
 - 수광 소자
 - list
 - WinAPI
 - set
 
                            Archives
                            
                        
                          
                          - Today
 
- Total
 
Kim's Programming
Map - lower_bound() 본문
소스)
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  | #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";     std::map<int, std::string>::key_compare KComp= Map.key_comp();     print(Map);     print(*Map.lower_bound(2));     print(Map); }  | cs | 
내용)
lower_bound(x)함수는 map의 키값중에 x와 같거나 또는 x보다는 큰 값중에 가장 작은 값을 가진 pair를 가리키는 iterator를 리턴합니다.
결과)
'STL - Container > Container - Map' 카테고리의 다른 글
| Map - Operator '=' (0) | 2016.02.01 | 
|---|---|
| Map - max_size() (0) | 2016.02.01 | 
| Map - key_comp() (0) | 2016.02.01 | 
| Map - insert() (0) | 2016.02.01 | 
| Map - find() (0) | 2016.02.01 |