다음을 통해 공유


operator< (map)

맵 개체는 연산자의 왼쪽에서 오른쪽에 맵 개체 보다 인지 테스트 합니다.

bool operator<(
   const map <Key, Type, Traits, Allocator>& _Left,
   const map <Key, Type, Traits, Allocator>& _Right
);

매개 변수

  • _Left
    개체 형식의 .

  • _Right
    개체 형식의 .

반환 값

true 이면 ; 연산자의 오른쪽에 지도 보다 엄격 하 게 작은 맵 연산자의 왼쪽에 있는 경우 그렇지 않으면 거짓.

설명

맵 개체 비교 pairwise 요소 비교를 기반으로 합니다.보다 작음-부등 요소의 첫 번째 쌍의 비교는 두 개체 간의 관계를 기반으로 보다.

예제

// map_op_lt.cpp
// compile with: /EHsc
#include <map>
#include <iostream>

int main( )
{
   using namespace std;
   map<int, int> m1, m2, m3;
   int i;
   typedef pair<int, int> Int_Pair;

   for ( i = 1 ; i < 3 ; i++ )
   {
      m1.insert ( Int_Pair ( i, i ) );
      m2.insert ( Int_Pair ( i, i * i ) );
      m3.insert ( Int_Pair ( i, i - 1 ) );
   }

   if ( m1 < m2 )
      cout << "The map m1 is less than the map m2." << endl;
   else
      cout << "The map m1 is not less than the map m2." << endl;

   if ( m1 < m3 )
      cout << "The map m1 is less than the map m3." << endl;
   else
      cout << "The map m1 is not less than the map m3." << endl;
}
  
  

요구 사항

헤더: <map>

네임 스페이스: std

참고 항목

참조

표준 템플릿 라이브러리