operator> (map)

如果在运算符左侧的映射对象与右侧,的映射对象的测试。

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

参数

  • _Left
    类型 映射对象。

  • _Right
    类型 映射对象。

返回值

true,如果在运算符左侧的映射与运算符右侧的映射大于;否则 false

备注

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

示例

// map_op_gt.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 = 0 ; 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 greater than the map m2." << endl;
   else
      cout << "The map m1 is not greater than the map m2." << endl;

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

要求

标头: <map>

命名空间: std

请参见

参考

标准模板库