operator>= (map)

测试,如果运算符左侧的映射对象大于或等于右侧的映射对象。

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

参数

  • _Left
    类型 映射对象。

  • _Right
    类型 映射对象。

返回值

true,如果运算符左侧的映射是大于或等于映射在列表的右侧;为 false

备注

在映射对象之间的比较基于元素的一种比较成对。 大于或等于两个对象之间的关系。根据第一个不相等对比较元素。

示例

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

int main( )
{
   using namespace std;
   map < int, int > m1, m2, m3, m4;
   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 ) );
      m4.insert ( Int_Pair ( i, i ) );
   }

   if ( m1 >= m2 )
      cout << "Map m1 is greater than or equal to map m2." << endl;
   else
      cout << "The map m1 is less than the map m2." << endl;

   if ( m1 >= m3 )
      cout << "Map m1 is greater than or equal to map m3." << endl;
   else
      cout << "The map m1 is less than the map m3." << endl;

   if ( m1 >= m4 )
      cout << "Map m1 is greater than or equal to map m4." << endl;
   else
      cout << "The map m1 is less than the map m4." << endl;
}
  

要求

标头: <map>

命名空间: std

请参见

参考

标准模板库